Re: why use {} around vraiable?

From: Date: Thu, 20 Mar 2008 16:35:42 +0000
Subject: Re: why use {} around vraiable?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-271906@lists.php.net to get a copy of this message
On Thu, Mar 20, 2008 at 12:22 PM, Lamp Lists <lamp.lists@yahoo.com> wrote: > hi, > I saw several times that some people use this > > $parameters = array( > 'param1' => "{$_POST["param1"]}", > 'param2' => "{$_POST["param2"]}" > ); > > or > > $query = mysql_query("SELECT * FROM table1 WHERE id='{$session_id}'"); > > I would use: > > $parameters = array( > 'param1' => $_POST["param1"], > 'param2' => $_POST["param2"] > ); > > and > > $query = mysql_query("SELECT * FROM table1 WHERE id=' ".$session_id." > ' > "); > > > does it really matter? is there really difference or these are just two > "styles"? the short answer is yes. i think you can find a sufficient explanation here, http://us.php.net/manual/en/language.types.string.php#language.types.string.parsing.simple and here http://us.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex -nathan

« previous php.general (#271906) next »