$foo = 10 ;
echo gettype($foo) ;
echo "
$foo
" ;
$foo = (string) $foo ;
echo gettype($foo) ;
echo "
$foo
" ;
$foo = (double) $foo ;
echo gettype($foo) ;
echo "
$foo
" ;
$foo = (boolean) $foo ;
echo gettype($foo) ;
echo "
$foo
" ;
$foo = (integer) $foo ;
echo gettype($foo) ;
echo "
$foo
" ;
echo "
" ;
echo "an example of implicit recasting
" ;
$a = "10" ;
$b = "3" ;
echo "treating the variables as strings: " . $a . $b . "
" ;
echo "treating the variables as integers: " . ( $a + $b ) . "
" ;
echo "
" ;
$a = "x10x" ;
$b = "y3y" ;
echo "treating the variables as strings: " . $a . $b . "
" ;
echo "treating the variables as integers: " . ( $a + $b ) . "
" ;
?>