note 101137 added to language.types.type-juggling
| From: | garryfre at pacbell dot net | Date: | Mon, 29 Nov 2010 08:23:28 +0000 |
| Subject: | note 101137 added to language.types.type-juggling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174428@lists.php.net to get a copy of this message | ||
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)
----
Server IP: 208.69.120.55
Probable Submitter: 71.154.159.229
----
Manual Page -- http://www.php.net/manual/en/language.types.type-juggling.php
Edit -- https://master.php.net/note/edit/101137
Del: integrated -- https://master.php.net/note/delete/101137/integrated
Del: useless -- https://master.php.net/note/delete/101137/useless
Del: bad code -- https://master.php.net/note/delete/101137/bad+code
Del: spam -- https://master.php.net/note/delete/101137/spam
Del: non-english -- https://master.php.net/note/delete/101137/non-english
Del: in docs -- https://master.php.net/note/delete/101137/in+docs
Del: other reasons-- https://master.php.net/note/delete/101137
Reject -- https://master.php.net/note/reject/101137
Search -- https://master.php.net/manage/user-notes.php