Mega Code Archive

 
Categories / Php / Data Type
 

Force to change the data type by adding (int), (integer), (float), (double), or (real) in front of the variable

or value or by using the function intval() or floatval() <?php  $a = 123;  echo "is_int($a) = " . (is_int($a) ? "true" : "false") . "\n";  $a = '123';  echo "is_int((int)$a) = " . (is_int((int)$a) ? "true" : "false") . "\n";  ?>