Re: svn: /phpdoc/en/trunk/reference/var/functions/ is-numeric.xml
| From: | Peter Cowburn | Date: | Wed, 06 Mar 2013 13:42:38 +0000 |
| Subject: | Re: svn: /phpdoc/en/trunk/reference/var/functions/ is-numeric.xml | ||
| References: | 1 | Groups: | php.doc.cvs |
| Request: | Send a blank email to doc-cvs+get-11078@lists.php.net to get a copy of this message | ||
On 5 March 2013 21:27, Dejan Marjanovic <dm@php.net> wrote:
> dm Tue, 05 Mar 2013 21:27:21 +0000
>
> Revision:
> http://svn.php.net/viewvc?view=revision&revision=329671
>
> Log:
> Updated is_numeric description and example
>
> Changed paths:
> U phpdoc/en/trunk/reference/var/functions/is-numeric.xml
>
> Modified: phpdoc/en/trunk/reference/var/functions/is-numeric.xml
> ===================================================================
> --- phpdoc/en/trunk/reference/var/functions/is-numeric.xml 2013-03-05 21:21:59 UTC (rev
> 329670)
> +++ phpdoc/en/trunk/reference/var/functions/is-numeric.xml 2013-03-05 21:27:21 UTC (rev
> 329671)
> @@ -15,11 +15,12 @@
>
> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
> </methodsynopsis>
> <para>
> - Finds whether the given variable is numeric. Numeric strings consist of
> - optional sign, any number of digits, optional decimal part and optional
> - exponential part. Thus <literal>+0123.45e6</literal> is a valid numeric
> - value. Hexadecimal notation (<literal>0xFF</literal>) is allowed too but
> - only without sign, decimal and exponential part.
> + Finds whether the given variable is numeric. Numeric strings consist of optional
> + sign, any number of digits, optional decimal part and optional exponential part.
> + Thus <literal>+0123.45e6</literal> is a valid numeric value. Hexadecimal (e.g.
> + <literal>0xf4c3b00c</literal>), Binary (e.g.
> <literal>0b10100111001</literal>),
> + Octal (e.g. <literal>0777</literal>) notation is allowed too but only without
> + sign, decimal and exponential part.
> </para>
> </refsect1>
This change does not make a whole lot of sense. The original
description is for "numeric strings". You have added that binary and
octal notation is allowed too, but in context (numeric strings) the
former is not allowed, and the latter is only allowed because leading
zeros are stripped when looking to see if the string is a number.
>
> @@ -58,7 +59,10 @@
> $tests = array(
> "42",
> 1337,
> - "1e4",
> + 0x539,
> + 02471,
> + 0b10100111001,
> + 1337e0,
> "not numeric",
> array(),
> 9.1
As mentioned above, your description change is in the context of
"numeric strings". Your example uses integer literals; shouldn't it be
using strings too, to demonstrate the "numeric string" behaviour with
those binary and octal notations?