FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Array key names
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Array key names [message #184906 is a reply to message #184899] Fri, 14 February 2014 19:05 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
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(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Upload not working on adding progress bar script in HTML file
Next Topic: getting php mail error info
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 02:55:20 GMT 2024

Total time taken to generate the page: 0.04224 seconds