Re: {} forms

From: Date: Wed, 16 Nov 2011 19:00:19 +0000
Subject: Re: {} forms
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-315719@lists.php.net to get a copy of this message
On 11-11-16 09:27 AM, Richard Quadling wrote:
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).
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.

« previous php.general (#315719) next »