Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12833
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Array key names |
| Date | 2014-02-14 19:05 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <ldlpd7$e0g$1@dont-email.me> (permalink) |
| References | <1864yi9o87hzd$.13eojppqkwixm$.dlg@40tude.net> <bm675oFtgk9U1@mid.uni-berlin.de> <1f5dmj1ajrueb.q6jlzpybxgfj.dlg@40tude.net> |
On Fri, 14 Feb 2014 06:43:54 -0500, richard wrote:
> You Probably just typed it all in without any online testing.
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.
--
Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array key names John Smith <JohnSmith@example.com> - 2014-02-14 00:40 -0500
Re: Array key names "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2014-02-14 10:49 +0100
Re: Array key names richard <noreply@example.com> - 2014-02-14 06:43 -0500
Re: Array key names Scott Johnson <noonehome@chalupasworld.com> - 2014-02-14 05:43 -0800
Re: Array key names "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2014-02-14 18:28 +0100
Re: Array key names Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-14 19:05 +0000
Re: Array key names Christoph Michael Becker <cmbecker69@arcor.de> - 2014-02-14 15:09 +0100
csiph-web