php what type is this variable code example
Example 1: php what type of variable is it
echo gettype($var1)."\n";
echo gettype($var2)."\n";
echo gettype($var3)."\n";
Example 2: php define variable type
<?php
$foo = "5bar"; // string
$bar = true; // boolean
settype($foo, "integer"); // $foo is 5 (integer)
settype($bar, "string"); // $bar is "1" (string)
?>