im trying to convert string to integer but return 0 or wrong number. Below is the code i have tested. Anyone know why? Thanks
<?php
echo gettype(0x55)."\n"; //type is integer
echo 0x55."\n"; //this is correct
echo (int)"0x55"."\n"; //why 0?
echo intval("0x55"); //why 0?
return
integer 85 0 0
0before it has any Non-Numeric (thex) which terminates the cast, orintval()as its not a numerichexdec. But remove the "0x" first.echo (int)"3x55"."\n";and you will get3