Detecting the data type of a PHP variable
Posted by Daniel at 4:47 pm
Detecting the datatype of a specific PHP variable can be done by using PHP gettype() function. refer below for example.
<?php //define variables $on = true; $age = 20; $name = "daniel"; $price = 99.99; //Returns Boolean echo gettype($on); //Returns String echo gettype($name); //Returns Integer echo gettype($age); //Returns Double echo gettype($price); ?>