By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,408 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,408 IT Pros & Developers. It's quick & easy.

what will this mean? CategoryID=4,2

P: n/a
Hi,

If i have the following URI

http://localhost/shop/index.php?CategoryID=4,2

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

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
*** pe**********@yahoo.com wrote/escribió (16 May 2005 23:04:54 -0700):
http://localhost/shop/index.php?CategoryID=4,2 [...] (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)


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
--
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.