PHP/Reflection/is string
Using an is_ function to determine a proper data type
<source lang="html4strict">
<?php
$unknownvar = "asdf"; echo gettype ($unknownvar) . "
"; if (is_string ($unknownvar)){ echo "Is a string
"; }
?>
</source>
Using is_ function to determine a proper data type and then work with it
<source lang="html4strict">
<?php
$unknownvar = "Hello World"; echo gettype ($unknownvar) . "
"; if (is_string ($unknownvar)){ echo "Is a string
"; } $mynumber = "1.03"; $mynumber = settype ($mynumber ,"integer"); echo $mynumber . "
"; echo (int) $mynumber;
?>
</source>