type of php code example
Example 1: typeof php
gettype($var);
Example 2: find type in php
gettype($u)
Example 3: getttype php
gettype ( mixed $var ) : string
gettype ("SALUT") => string
gettype (2) => integer
...etc ...
"bool"
"integer"
"double"
"array"
"object"
"resource"
"NULL"
"unknown type"
Example 4: check type in php
gettype ( mixed $var ) : string
Example 5: php data types
<?php
$x = "Hello world!";
echo $x;
$x = 5985;
var_dump($x);
$x = 10.365;
var_dump($x);
$x = true;
$y = false;
$cars = array("Volvo","BMW","Toyota");
var_dump($cars);
class Car {
function Car() {
$this->model = "VW";
}
}
$herbie = new Car();
echo $herbie->model;
$x = "Hello world!";
$x = null;
var_dump($x);
?>
Example 6: PHP Data Types
<?php
$x = "Hello world!";
$y = 'Hello world!';
echo $x;
echo "<br>";
echo $y;
?>