<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - -
$var = A strictly numeric value
- - - - - - - - - - - - - - - - - - - - - - - - - - */
?>
GENERAL SPECIFICATIONS | ||
ID | THE SAME AS | IDENTIFYING |
INT | INTEGER | INTEGER NUMBERS |
INTEGER | ||
LONG | ||
FLOAT | FLOAT | DECIMAL NUMBERS |
DOUBLE | ||
REAL | ||
ed48 |
ABSOLUTE INTEGER VALUES | ||
ENVIRONMENT (#bit) | MINIMUM | MAXIMUM |
8 | 0 | +255 |
16 | 0 | +65535 |
32 | 0 | +4294967295 |
64 | 0 | +18446744073709551615 |
ed48 |
INTEGER RELATIVE VALUES | ||
ENVIRONMENT (#bit) | MINIMUM | MAXIMUM |
8 | −128 | +127 |
16 | −32768 | +32767 |
32 | −2147483648 | +2147483647 |
64 | −9223372036854775808 | +9223372036854775807 |
ed48 |
FLOAT VALUES | ||
ENVIRONMENT (#bit) | MINIMUM | MAXIMUM |
64 | 2.2250738585072E-308 | 1.7976931348623E+308 |
ed48 |
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME NUMERIC INTERNAL VARIABLE EXAMPLES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$var01 = $_SERVER['REQUEST_TIME'];
// The timestamp of the start of the request.
$var02 = $_SERVER['REQUEST_TIME_FLOAT'];
// The timestamp, with precision in microseconds,
// from the beginning of the request
echo $var01 . '<br><br>' . $var02;
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME NUMERIC USER-DEFINED VARIABLE EXAMPLES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
setlocale(LC_ALL, 'pt-BR', 'pt_BR');
// Only compatible with LOCALE, up to PHP 7.4.XX
// INTEGER
$x01p = 220;
$x01n = -220;
echo $x01p . '<br>' . $x01n . '<br><br>';
// FLOAT
$x02p = 123.456;
$x02n = -123.456;
echo $x02p . '<br>' . $x02n . '<br><br>';
// CIENTIFIC NOTATION
$x03p = 1E19;
$x04p = 1.6e-19;
echo $x03p . '<br>' . $x04p . '<br><br>';
// HEXADECIMAL NOTATION ->
// -> (20b)base 16 = (20B)base 16 = (523)base 10
$x05p = 0x20b;
$x06p = 0X20B;
echo $x05p . '<br>' . $x06p . '<br><br>';
// OCTAL NOTATION ->
// -> (1023)base 8 = (531)base 10
$x07p = 01023;
echo $x07p . '<br><br>';
// BINARY NOTATION
// -> (0011)base 2 = (3)base 10
$x08p = 0b0011;
// Available since PHP 5.4.0
echo $x08p . '<br><br>';
// NUMERIC LITERALS CAN NOW CONTAIN UNDERSCORES
// PHP 7.4
$x09f = 5.567_076-10;
echo $x09f . '<br><br>';
$x10d = 300_123_456;
echo $x10d . '<br><br>';
$x11h = 0xAEAE_FADA;
// (AEAEFADA)base 16 = 2930703766)base 10
echo $x11h . '<br><br>';
$x12b = 0b1110_0011;
// (11100011)base 2 = (227)base10
echo $x12b . '<br><br>';
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME NUMERIC INTERNAL CONSTANT EXAMPLES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
setlocale(LC_ALL, 'pt-PT', 'pt_PT');
// Only compatible with LOCALE, up to PHP 7.4.XX
$var_e = M_E;
// VALUE of e
$var_pi = M_PI;
// VALUE of PI
$var_sqr2 = M_SQRT2;
// SQUARE ROOT of 2
$var_php = PHP_VERSION;
// PHP VERSION
echo "$var_e<br><br>$var_pi<br><br>$var_sqr2<br><br>$var_php";
?>