sasori Posted August 4, 2008 Share Posted August 4, 2008 (im noob, so be patient) let's say i want to create a class that accepts an integer and a float datatype, how will you code that? should i create two different classes? like class Customerorder { private $total = 0; //the rest of the code here; } class Customerorder { private $total = 0.0; //for the float //the rest of the code here; } is this thing good? or there's another way to write it using only a single class? Quote Link to comment https://forums.phpfreaks.com/topic/118039-solved-datatype-help/ Share on other sites More sharing options...
genericnumber1 Posted August 4, 2008 Share Posted August 4, 2008 PHP isn't a type-picky language (I say that like it's a good thing, and most of the time it is). What implementations can you imagine needing the different data types? Also, no, you can't have 2 classes with the same name. Quote Link to comment https://forums.phpfreaks.com/topic/118039-solved-datatype-help/#findComment-607291 Share on other sites More sharing options...
sasori Posted August 4, 2008 Author Share Posted August 4, 2008 ok thanks for the reply , i got it working now.. this PHP thing is giving me lot of fun surprises Quote Link to comment https://forums.phpfreaks.com/topic/118039-solved-datatype-help/#findComment-607307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.