php gettype
snippet in php

php get variable type

user6090


<?php

  $a = 3;
echo gettype($a) . "<br>";

$b = 3.2;
echo 
  gettype($b) . "<br>";

  
$c = "Hello";
echo gettype($c) . "<br>";

$d = array();
echo 
  gettype($d) . "<br>";

$e = array("red", "green", "blue");
echo 
  gettype($e) 
  . "<br>";

$f = NULL;
echo gettype($f) . "<br>";

  
$g = false;
echo gettype($g) . "<br>";
?>
 

find type in php

user8582

gettype($u)

php get type of object

user8199

gettype($object);

php gettype

user3596

<?php
    $a = 3;
    echo gettype($a) . "<br>"; // integer

    $b = 3.2;
    echo gettype($b) . "<br>"; // double

    $c = "Hello";
    echo gettype($c) . "<br>"; // string

    $d = array();
    echo gettype($d) . "<br>"; // array

    $e = array("red", "green", "blue");
    echo gettype($e) . "<br>"; // array

    $f = NULL;
    echo gettype($f) . "<br>"; // NULL

    $g = false;
    echo gettype($g) . "<br>"; // boolean
?>

typeof php

user3578

gettype($var);