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

Home » Imported messages » comp.lang.php » Array variable in echo statement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Array variable in echo statement [message #169782] Sun, 26 September 2010 18:24 Go to previous message
MikeB is currently offline  MikeB
Messages: 65
Registered: September 2010
Karma:
Member
I tried this and it didn't work as I was hoping:

foreach ($_COOKIE as $c) {
$ck = key($_COOKIE);
echo "<br /> Cookie: Key:\"{key($_COOKIE)}\" value:\"$c\"";
}

Now while I got this to work:

foreach ($_COOKIE as $ck => $c) {
echo "<br /> Cookie: Key:\"$ck\" value:\"$c\"";
}

I'd still like to know why the curly braces in the first example didn't
resolve the array function - I thought that was what they were supposed
to do?

Thanks, as usual.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Can anyone recommend a good debugger & IDE for PHP?
Next Topic: Newbie: Displaying a 'message box'
Goto Forum:
  

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

Current Time: Sat Nov 23 23:40:39 GMT 2024

Total time taken to generate the page: 0.03348 seconds