Type Juggling¶
Type juggling is the emblematic PHP feature, where data has no specific type definition, and its type may change depending on the situation.
For example, integers are translated into string when displayed, or kept as integers to be used with math operations.
Type juggling is usually done automatically, without user intervention. Explicit type juggling is achieved with the cast operators.
<?php
$a = "35";
echo $a + 4; // display 39
echo substr($a, -1); // display 5
?>
See also Type Juggling and Loose Comparison
Related : Cast Operator