Mega Code Archive

 
Categories / Php / Language Basics
 

Testing the Type of a Variable

<html> <head> <title>Testing the type of a variable</title> </head> <body> <?php $testing = 5; print gettype( $testing ); // integer print "<br>"; $testing = "five"; print gettype( $testing ); // string print("<br>"); $testing = 5.0; print gettype( $testing ); // double print("<br>"); $testing = true; print gettype( $testing ); // boolean print "<br>"; ?> </body> </html>