Integers can be written in decimal, octal, or hexadecimal.
Decimal numbers are a string of digits with no leading zeros. Any integer may
begin with a plus sign ( + ) or a minus sign ( - ) to indicate whether it is a
positive or negative number. If there is no sign, then positive is assumed.
Valid decimal integers:
1
123
+7
-1007395
Valid octal integers:
01
0123
+07
-01007345
Valid hexadecimal integers:
0x1
0xff
0x1a3
+0x7
-0x1ab7345
Example : The PHP var_dump() function returns the data type and value of variables:
<?php
$a = 5;
var_dump($x);
echo "<br>";
$x = -5; // negative number
var_dump($x);
echo "<br>";
$x = 0x8C; // hexadecimal
number
var_dump($x);
echo "<br>";
$x = 047; // octal number
var_dump($x);
?>
Comments
Post a Comment