0

As I mentioned earlier, in the script below, I don't know what is the data type of "0XB"?

$a = 0XB;
$b= 1;
$c= $a + $b;
var_dump($c);

The result is 12, which means 0XB is 11, I am not sure how PHP interpreter 0XB is equal to 11.

Can someone give me an explanation regarding this one and the use cases of this data type?

Thank you in advanced

huyleuit
  • 178
  • 1
  • 1
  • 9
  • 3
    https://www.php.net/manual/en/language.types.integer.php – Diego D Dec 21 '22 at 10:19
  • 1
    Read about the [integer type](https://www.php.net/manual/en/language.types.integer.php) in the PHP documentation. – axiac Dec 21 '22 at 10:20
  • 3
    You can get a direct answer from PHP by using [gettype()](https://www.php.net/manual/en/function.gettype), see: https://3v4l.org/tHZIe It's an integer and `B` is [hexadecimal](http://ctp.mkprog.com/en/php/hexadecimal_literals/) for `11`. – KIKO Software Dec 21 '22 at 10:23

0 Answers0