Type casting

clookid

203.***.***.***
1,200 days ago

Type casting

Type casting
Like Perl, variables are cast automatically into the right types (integer, floating point, string, etc.) though you can force them if you want. Just put the required type in front of the variable in brackets

PHP code:

$mynum = 3.01;
$intnum = (int) $mynum;



Check this out in the PHP manual if you want to know more about typecasting. In general it's not necessary since there are functions for dealing with (for example) number formatting.