You Probably just typed it all in without any online testing.
The only true way of testing what is allowed and what isn't, is to do so on
the server you're going to be using.
e.g. your local machine you are using to test on at home has php 5.5.
while your host uses 5.3.
What worked for you suddenly fails.

On 2/14/14, 3:43 AM, richard wrote:> On Fri, 14 Feb 2014 10:49:44 +0100, M. Strobel wrote:> >> Am 14.02.2014 06:40, schrieb John Smith:>>> Just one simple question. Are spaces allowed in key names?>>> Such as $name=array("John Smith" +> "somethig").>>> >> >> >> I am testing it for you.>> >> str@suse131:~> php -a>> Interactive mode enabled>> >> php > $a['is it really me?'] = 99.999;>> php > print_r($a);>> Array>> (>> [is it really me?] => 99.999>> )>> php >>> >> /Str.> > You Probably just typed it all in without any online testing.> The only true way of testing what is allowed and what isn't, is to do so on> the server you're going to be using.> e.g. your local machine you are using to test on at home has php 5.5.> while your host uses 5.3.> What worked for you suddenly fails.>

richard I would be very careful telling others who have obviously more
experience then you in PHP on how to and not to do coding/testing in
PHP. You may not really know enough about what you think you know. I
learned that some time ago.

For starters, Strobel is using what is called command prompt. Great for
testing a snippet of code without loading up the editor and such.

Secondly the OP is asking a simple question, which he could of actually
tested on his own, and Strobel is wise enough to understand it was not
affected by a minor version release.

Am 14.02.2014 12:43, schrieb richard:> On Fri, 14 Feb 2014 10:49:44 +0100, M. Strobel wrote:> >> Am 14.02.2014 06:40, schrieb John Smith:>>> Just one simple question. Are spaces allowed in key names?>>> Such as $name=array("John Smith" +> "somethig").>>> >> >> >> I am testing it for you.>> >> str@suse131:~> php -a>> Interactive mode enabled>> >> php > $a['is it really me?'] = 99.999;>> php > print_r($a);>> Array>> (>> [is it really me?] => 99.999>> )>> php >>> >> /Str.> > You Probably just typed it all in without any online testing.> The only true way of testing what is allowed and what isn't, is to do so on> the server you're going to be using.> e.g. your local machine you are using to test on at home has php 5.5.> while your host uses 5.3.> What worked for you suddenly fails.>

Dipshit, we just had this fucking conversation. Piss off home and leave
the technical help and advice to people who know what they're talking
about, there's a good ignoramus.

For the OP, who hopefully has ignored every piece of claptrap richard has
spoken:

A string style array index can comprise any valid sequence of string
characters, including escape sequences for things such as tab, newline
etc. It's a string, it can contain the same as any other string, the fact
that it's being used as an array index does not change it's basic
stringiness.

Indeed there's no reason not to do this, apart from it would be a really
weird thing to do:

<?php

$_POST = array( "monkey" =>"\t\tsomething\t\t" );

$i = <<< EOT
This is my really long string array index.

It has several lines. In here I'm adding some post data:

The post data is the value of the monkey form field: '{$_POST['monkey']}'

That's a very bad example to give, because I'm using unvalidated and
unverified user input. Jerry will call me out on this, and rightly so.

Meanwhile, here are some other things \n\n\n\n\n\t\t\t\t\t\nStuff

"and nonsense"

!!!!!!!!!!! <- madness

EOT;

$x = array( $i => "fred" );

var_dump( $x );

?>

Note - if you ever actually use an array key like that in production code
then you deserve all the future pain and suffering that your code is
surely going to cause you when it rises up as the toilet dragon of
unhappiness and bites you very hard on the buttocks.