note 111522 added to language.types.string

From: Date: Thu, 28 Feb 2013 18:20:57 +0000
Subject: note 111522 added to language.types.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-193753@lists.php.net to get a copy of this message
Leading zeroes in strings are (least-surprise) not treated as octal. Consider: $x = "0123" + 0; $y = 0123 + 0; echo "x is $x, y is $y"; //prints "x is 123, y is 83" in other words: * leading zeros in numeric literals in the source-code are interpreted as "octal", c.f. strtol(). * leading zeros in strings (eg user-submitted data), when cast (implicitly or explicitly) to integer are ignored, and considered as decimal, c.f. strtod(). ---- Server IP: 69.147.83.199 Probable Submitter: 87.194.171.29 ---- Manual Page -- http://php.net/manual/en/language.types.string.php Edit -- https://master.php.net/note/edit/111522 Del: integrated -- https://master.php.net/note/delete/111522/integrated Del: useless -- https://master.php.net/note/delete/111522/useless Del: bad code -- https://master.php.net/note/delete/111522/bad+code Del: spam -- https://master.php.net/note/delete/111522/spam Del: non-english -- https://master.php.net/note/delete/111522/non-english Del: in docs -- https://master.php.net/note/delete/111522/in+docs Del: other reasons-- https://master.php.net/note/delete/111522 Reject -- https://master.php.net/note/reject/111522 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193753) next »