Re: {} forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11-11-16 09:27 AM, Richard Quadling wrote:
On 16 November 2011 13:56, Tim Streater<tim@xxxxxxxxxxxxxxxx>  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).


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.


The braces are also used when the characters following the variable are also valid variable name characters :)

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux