what will this mean? CategoryID=4,2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • petermichaux@yahoo.com

    what will this mean? CategoryID=4,2

    Hi,

    If i have the following URI



    what will the following be?

    (int)$_GET['CategoryID']

    On my computer evaluates as 4. Is it guaranteed to evaluate as 4 on any
    server with php? Where can i read specs like this? (As long as it is
    always 4 then my problems are solved)

    Thanks!
    Peter

  • Alvaro G Vicario

    #2
    Re: what will this mean? CategoryID=4,2

    *** petermichaux@ya hoo.com wrote/escribió (16 May 2005 23:04:54 -0700):[color=blue]
    > http://localhost/shop/index.php?CategoryID=4,2[/color]
    [...][color=blue]
    > (int)$_GET['CategoryID']
    >
    > On my computer evaluates as 4. Is it guaranteed to evaluate as 4 on any
    > server with php? Where can i read specs like this? (As long as it is
    > always 4 then my problems are solved)[/color]

    This is what manual says:

    * * *

    When a string is evaluated as a numeric value, the resulting value and type
    are determined as follows.

    The string will evaluate as a float if it contains any of the characters
    '.', 'e', or 'E'. Otherwise, it will evaluate as an integer.

    The value is given by the initial portion of the string. If the string
    starts with valid numeric data, this will be the value used. Otherwise,
    the value will be 0 (zero). Valid numeric data is an optional sign,
    followed by one or more digits (optionally containing a decimal point),
    followed by an optional exponent. The exponent is an 'e' or 'E' followed
    by one or more digits.

    * * *

    In any case, functions like preg_match() or explode() may (or may not :) make your code clearer.

    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- http://bits.demogracia.com - Mi sitio sobre programación web
    -- Don't e-mail me your questions, post them to the group
    --

    Comment

    Working...