[FX.php List] Stumbled on something I hadn't realized...

Joel Shapiro jsfmp at earthlink.net
Thu Nov 13 12:43:59 MST 2008


Be aware that if you use this in places that need double quotes (e.g.  
in html tags), you'll need to escape the quotes, such as:

echo "<a href=\"page.php?id=$id\">";

Also, supposedly it takes PHP longer to parse through double-quoted  
strings looking for $vars than it does when using single-quoted  
strings and periods, but I think the speed difference is probably  
insignificant -- and since you're already using double-quotes anyway,  
it shouldn't slow things down at all.

-Joel


On Nov 13, 2008, at 11:11 AM, Bob Patin wrote:

> I didn't realize that in PHP you can write
>
> <?php
>
> $string = "Bob";
>
> echo "$string needs to read up on PHP.";
>
> ?>
>
> I've been writing this:
>
> echo $string." needs to read up on PHP.";
>
> It never occurred to me to that you could put variables inside  
> quotes like that and that they'd be echoed back rather than  
> displayed as text...
>
> I've been writing things the hard way all this time... sheesh...
>
> Hopefully this will save someone else some time...
>
> Bob Patin
> Longterm Solutions LLC
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> iChat/AIM: bobpatin
> FileMaker 9 Certified Developer
> Member of FileMaker Business Alliance
> --------------------------
> FileMaker hosting and consulting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list