<?php
$foo = "0"; // $foo is string (ASCII 48)
$foo += 2; // $foo is now an integer (2)
$foo = $foo + 1.3; // $foo is now a float (3.3)
$foo = 5 + "10 Tiny Wangs"; // $foo is integer (15)
$foo = 5 + "10 Monstrous Cocks"; // $foo is integer (15)
?>
You cannot do that, that goes against the teachings of dead dogs!
Name:
Anonymous2009-06-29 19:04
Type coercion isn't necessarily a bad thing, but PHP does go overboard.
It combines particularly nicely with the fact that the concatenation operator is . and not + like in every other language. You get hilariously nonsensical errors if you mess them up, e.g. in SQL queries.