Check if a variable is array or integer or numeric in PHP

Description

The following code shows how to check if a variable is array or integer or numeric.

Example


<?php/*from  w w  w.j ava  2 s  . co m*/
     $item = 43;
     echo "The variable \$item is of type array: ".is_array($item)."<br />";
     echo "The variable \$item is of type integer: ".is_integer($item)."<br />";
     echo "The variable \$item is numeric: ".is_numeric($item)."<br />";
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition