note 64922 deleted from language.types.string by nlopess

From: Date: Sun, 23 Apr 2006 10:02:14 +0000
Subject: note 64922 deleted from language.types.string by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109139@lists.php.net to get a copy of this message
Note Submitter: ---- 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.

« previous php.notes (#109139) next »