<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Aliases:
is_integer and is_long
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
bool is_int ( mixed $value );
where,
$value = VARIABLE to test
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - -
This is a simple example using
var_dump
to display the variable as is
- - - - - - - - - - - - - - - - - - - - - - - */
var_dump($_SERVER['REMOTE_ADDR']);
echo '<br><br>';
var_dump($_SERVER['HTTP_USER_AGENT']);
echo '<br><br>';
var_dump($_SERVER['HTTP_ACCEPT_LANGUAGE']);
echo '<br><br>';
var_dump(M_E);
echo '<br><br>';
$x04p = 1.6e-19;
var_dump($x04p);
$arr07 = [ 'c' => 299792458, 'G' => 6.67428E-11 ];
echo '<br><br>';
var_dump($arr07);
$varN01 = NULL;
echo '<br><br>';
var_dump($varN01);
echo '<br><br>';
$varI0 = 123456;
var_dump($varI0);
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a simple example using
an user-defined function
to display if the variable
is INT
The same as: is_integer or is_long
- - - - - - - - - - - - - - - - - - - - - - - - - - - */
$var01 = $_SERVER['REMOTE_ADDR'];
$var02 = $_SERVER['HTTP_USER_AGENT'];
$var03 = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$var04 = M_E;
$x04p = 1.6e-19;
$arr07 = [ 'c' => 299792458, 'G' => 6.67428E-11 ];
$varN01 = NULL;
$varI0 = 123456;
$varI1 = '123456';
$var08 = 0XFADA;
$var09 = 0b1110_0011;
$var10 = 300_123_456;
function isint($var)
{
if(is_int($var))
// if(is_integer($var))
// if(is_long($var))
{
var_dump($var);
echo '<br>is INT<br><br>';
}
else
{
var_dump($var);
echo '<br>is NOT INT<br><br>';
}
}
isint($var01);
isint($var02);
isint($var03);
isint($var04);
isint($x04p);
isint($arr07);
isint($varN01);
isint($varI0);
isint($varI1);
isint($var08);
isint($var09);
isint($var10);
?>