note 101137 rejected from language.types.type-juggling by thiago

From: Date: Mon, 29 Nov 2010 11:52:51 +0000
Subject: note 101137 rejected from language.types.type-juggling by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174431@lists.php.net to get a copy of this message
Note Submitter: garryfre at pacbell dot net ---- It is unfortunate that in the first example on type juggling that the first line sets $foo = "0" instead of any other numeric value as a string leaving what actually happens here quite vague. Compare these two lines as is shown in the example.... $foo = "0"; // $foo is string (ASCII 48) $foo += 2; // $foo is now an integer (2) With these two lines which are much clearer and leaves no doubt what is happening ... $foo = "1"; // $foo is string (ASCII 49) $foo += 2; // $foo is now an integer (3)

« previous php.notes (#174431) next »