Force a variable into a specific data type : settype « Data Type « PHP






Force a variable into a specific data type

 
<?php 
    $mynumber = "1.03"; 
    $mynumber = settype ($mynumber ,"integer"); 
    echo $mynumber . "<br />"; 
    echo (int) $mynumber; 
?>
  
  








Related examples in the same category

1.Changing Type with settype()