Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Comments for: vaska20050812

Message # 1030305:
Date: 09/14/05 14:22
By: Per Persson
Subject: Tip #6

I think that
$var = "This is the $value of things.";
is easier to read than
$var = 'This is the ' . $value . ' of things.';
especially when there are a lot of short strings.
However, I often prefer to mark it with braces:
$var = "This is the {$value} of things.";

One problem, though, is that you can only use variables inside strings. Constants and expressions are not supported. I would rather write
$var = "{$num} books, \${$price} each cost \${$count*$price}.";
than
$var = "{$num} books, \${$price} each cost \$" . ($count*$price) . "}.";

See
http://www.zend.com/phorum/read.php?num=6&id=2610&loc=0&thread=2610
http://www.zend.com/phorum/read.php?num=6&id=655&loc=0&thread=655

Previous Message | Next Message


Comments:
Tip #6Per Persson09/14/05 14:22
Excellent InformationShafiq Rehman09/09/05 08:47
Part One URLVaska08/21/05 08:52
10 Tips That Every PHP Developer Should Know,Clement08/19/05 12:43
Updated the articlevaaaska08/17/05 14:28
easier to readtof08/16/05 04:22
from the editorScott08/15/05 15:22
Error in your tutJohn08/15/05 12:53
correction...Piotr08/15/05 11:44
Tip 6Scott Reynen08/15/05 09:42
correction...matt08/15/05 02:33
Very niceLogan K.08/14/05 11:22
WHAT?!Jesse08/14/05 01:28
Tip #5Toby08/13/05 17:32
Few tips Jeffery Vaska should know.root08/12/05 14:10
"hackers"martin sarsale08/12/05 11:23
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.