Re: why use {} around vraiable?

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

 




On Mar 20, 2008, at 12:22 PM, Lamp Lists 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." ' ");


I may have been the one you were talking about so I figured I should reply. I picked up the habit doing that for stuff that was being displayed using HEREDOC. When I asked for some help awhile back on a project I was working on and they said to use HEREDOC, and gave an example of how to do it and they had all the variables surrounded with {} So I assumed you had to do it that way...

Anyone care to correct me?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim@xxxxxxxxxx




--
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