Reply to Re: spaces in array_keys($_GET)?

Your name:

Reply:


Posted by Kimmo Laine on 12/18/05 11:26

"yawnmoth" <terra1024@yahoo.com> kirjoitti
viestissδ:1134887049.415099.281110@f14g2000cwb.googlegroups.com...
> Say I have the following script - test.php:
>
> <?
> if (count($_GET) != 0)
> {
> foreach(array_keys($_GET) as $var)
> {
> echo "$var<br />";
> }
> }
> ?>
>
> Is it possible for $var to contain a space? If I call "test.php?this
> is=a test" it gets turned into "test.php?this%20is=a%20test" by the
> browser and the output of the above is "this_is" - not "this is". If I
> call "test.php?this+is=a+test", the output is still "this_is".
>
> I'm gonna guess it isn't possible - I just want to make sure.


It's mentioned in the php manual that: "A valid variable name starts with a
letter or underscore, followed by any number of letters, numbers, or
underscores." - so no, it's not possible, as space is not either number,
letter nor an underscroe. The reason for this is that a Php Fairy dies every
time someone uses a space in a variable name. So think about the faries,
don't use the spaces.

--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <antaatulla.sikanautaa@gmail.com.NOSPAM.invalid>

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация