PHP/Reflection/gettype

Материал из Web эксперт
Перейти к: навигация, поиск

Creating an object from the Cat class

   <source lang="html4strict">

<?php class Cat { } $fluffy = new Cat( ); echo gettype($fluffy); ?>

 </source>
   
  


Displaying the Type of a Variable

   <source lang="html4strict">

<html> <body>

<?php

   $testing; // declare without assigning
   print gettype( $testing ); 
   print "
"; $testing = 5; print gettype( $testing ); print "
"; $testing = "five"; print gettype( $testing ); print "
"; $testing = 5.0; print gettype( $testing ); print "
"; $testing = true; print gettype( $testing ); print "
";

?>

</body>

 </source>