Re: {} forms
| From: | Richard Quadling | Date: | Wed, 16 Nov 2011 14:27:59 +0000 |
| Subject: | Re: {} forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315715@lists.php.net to get a copy of this message | ||
On 16 November 2011 13:56, Tim Streater <tim@clothears.org.uk> wrote:
> I'm looking at the source of a web sockets server and I see these various forms:
>
> "ws://{$host}{$path}"
> "HTTP/1.1 ${status}\r\n"
>
> Are these simply equivalent to:
>
> "ws://" . $host . $path
> "HTTP/1.1 " . $status . "\r\n";
>
> and if so, is there any particular benefit to using that form? Or if not, what do they mean?
>
> (I've read up about variable variables).
>
> Thanks,
>
> --
> Cheers -- Tim
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
If you want to embed $array[CONSTANT], then the {} is used.
I use {} out of habit for non arrays. Not sure if there is an impact.
http://docs.php.net/manual/en/language.types.string.php#example-71
shows the use.
Oh. I've fixed the layout bug for
http://docs.php.net/manual/en/language.types.string.php#example-70.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370