Mega Code Archive

 
Categories / Php / Language Basics
 

Changing the Type of a Variable with settype()

<html> <head> <title>Changing the type of a variable with settype()</title> </head> <body> <?php $undecided = 3.14; print gettype( $undecided );  print " -- $undecided<br>";   settype( $undecided, string ); print gettype( $undecided );  print " -- $undecided<br>";   settype( $undecided, integer ); print gettype( $undecided );  print " -- $undecided<br>";   settype( $undecided, double ); print gettype( $undecided );  print " -- $undecided<br>";   settype( $undecided, boolean ); print gettype( $undecided );  print " -- $undecided<br>";    ?> </body> </html>