Re: using . to concatenate strings ?
| From: | Martin Jansen | Date: | Thu, 04 Dec 2003 17:33:32 +0000 |
| Subject: | Re: using . to concatenate strings ? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24148@lists.php.net to get a copy of this message | ||
On Thu Dec 04, 2003 at 09:5520AM +0100, Daniel Khan wrote:
> Arnaud Limbourg wrote:
>
> >i have a php question.
> >
> >What is the best way to go ?
> >
> >$str = 'text ' . $obj->myvar . ' extrat text';
> >
> >or
> >
> >$str = "text {$obj->myvar} extrat text';
> >
> >Does one have advantages over the other ?
I'd opt for the first one. It looks cleaner and editor will highlight it
properly, whilst that may not be the case for the second one.
> I use sprintf() for most things.
Be aware that sprinft() and prinft() are extremely slow.
--
- Martin Martin Jansen
http://martinjansen.com/