the php code is pretty simple :
<?php
$my_bn_num=number_bangla(0123);
function number_bangla($num1){
echo ("<br>num =".$num1);
}
?>
And the ouput is: num=83
But if I call the function with a singly quoted string like this:
$my_bn_num=number_bangla('0123');
the output is: num=0123
What is the detailed difference between 0123 and ‘0123’ here ?
0123 is a numeric value whereas ‘0123’ is a string value. Internally PHP stores those types differently.
In order to cast string to integer you can do following:
In this particular example printing number 0123 results to 83 because 0123 is an octal value. For casting octal strings to octal numbers PHP offers octdec() function: