How to Get the Type of a Variable in PHP
In this lesson we are going to see how to get the type of a variable in PHP, as you know when working with PHP sometimes you need to know the type of a variable.
Get the Type of a Variable in PHP using gettype() Function
gettype() is a function in PHP that returns the type of a variable value, it takes the variable to check as a param and returns the type.
<?php
$data = (1, 2, 3);
echo gettype($data);
// output array
?>