|
-
Feb 21st, 2002, 12:47 PM
#1
Thread Starter
Member
Today's PHP Tip
I am going to try and post a tip everyday.
This one came to my mind when I saw filburt1's code on cookies:
PHP parses strings that are enclosed in double quotes ("i will be parsed"), as opposed to those enclosed in single quotes, which are used on face value.
So If you do
<?php
$somevar = 121;
echo "I am $somevar";
?>
you get
I am 121
If the same read
<?php
$somevar = 121;
echo 'I am $somevar';
?>
you get
I am $somevar
So as an optimization, don't put code like echo "<TR><TD>" in double quotes. Put it in single, so the PHP engine doesn't have to parse it.
HTH
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|