Changing Type with settype()
<html>
<body>
<div>
<?php
$undecided = 3.14;
print gettype( $undecided );
print " -- $undecided<br />";
settype( $undecided, string );
print gettype( $undecided );
print " -- $undecided<br />";
settype( $undecided, int );
print gettype( $undecided );
print " -- $undecided<br />";
settype( $undecided, double );
print gettype( $undecided );
print " -- $undecided<br />";
settype( $undecided, bool );
print gettype( $undecided );
print " -- $undecided<br />";
?>
</div>
</body>
</html>
Related examples in the same category