note 64922 added to language.types.string

From: Date: Sun, 23 Apr 2006 02:22:19 +0000
Subject: note 64922 added to language.types.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-109105@lists.php.net to get a copy of this message
The statement in the documentation, "The string will evaluate as a float if it contains any of the characters '.', 'e', or 'E'." is not quite correct. It seems it could validly state, however, that the string will evaluate as a float if it contains any of the characters '.', 'e', or 'E' in a valid float sequence at the beginning of the string. Thus, the following evaluates as a float: <?php var_dump(1+"2e5"); // float(200001) ?> but the following example (obtained from the documentation itself) does not: <?php $foo = 1 + "bob-1.3e3"; // $foo is integer (1) ?> It might also be noted that whitespace preceding a valid float or integer in a string will produce a valid numerical result. ---- Server IP: 66.163.161.117 Probable Submitter: 218.17.94.48 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.types.string.php Edit -- http://master.php.net/note/edit/64922 Del: integrated -- http://master.php.net/note/delete/64922/integrated Del: useless -- http://master.php.net/note/delete/64922/useless Del: bad code -- http://master.php.net/note/delete/64922/bad+code Del: spam -- http://master.php.net/note/delete/64922/spam Del: non-english -- http://master.php.net/note/delete/64922/non-english Del: in docs -- http://master.php.net/note/delete/64922/in+docs Del: other reasons-- http://master.php.net/note/delete/64922 Reject -- http://master.php.net/note/reject/64922 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#109105) next »