intval() function: pass a second parameter that specifies the base for the conversion : intval « Data Type « PHP






intval() function: pass a second parameter that specifies the base for the conversion

 
<?php 

echo intval('123', 10) . "\n"; 
echo intval('101010', 2) . "\n"; 
echo intval('123', 8) . "\n"; 
echo intval('123', 16) . "\n"; 
echo intval('H123', 32) . "\n"; 
echo intval('H123', 36) . "\n"; 
?>
  
  








Related examples in the same category

1.Checking for a number range
2.intval() function: pass a second parameter that specifies the base to use for the conversion.