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
Re: Array variable in echo statement [message #169787 is a reply to message #169784] Sun, 26 September 2010 20:46 Go to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(MikeB)

> Marious Barrier wrote:
>>
>> The curly braces are meant to wrap array variables, not functions.
>
> Right. Thanks. So that mean that if I want the result of a function in
> an output statement I should put it in a variable prior to the output
> statement?
>
> Like this:
>
> $ck=key($_COOKIE);
> echo "The key is $ck";

Yes. Or have a look at printf(), which is extremely handy in situations
like this, especially if there are more than one variable:

printf('The key is %s.', key($_COOKIE));

Micha
[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: Wed Nov 27 10:30:35 GMT 2024

Total time taken to generate the page: 0.15598 seconds