➤ The gettype() function returns the type of a variable. Syntax:
gettype(variable);
For instance:
$int = 10;
echo gettype($int)."\n"; // outputs:  integer

$str = "PHP";
echo gettype($str)."\n"; // outputs:  string

$flt = 1.2;
echo gettype($flt)."\n"; // outputs:  double  (also called float)

$bool = true;
echo gettype($bool)."\n"; // outputs:  boolean

$arr = [1,2,3,4,5,6,7,8,9,10];
echo gettype($arr)."\n"; // outputs:  array
by Levani Makhareishvili
2 years ago
PHP
Function
1
Pro tip: use ```triple backticks around text``` to write in code fences