You are here: Re: Function Evaluation inside a literal. « PHP Programming Language « IT news, forums, messages
Re: Function Evaluation inside a literal.

Posted by lorento on 06/26/06 11:25

Hmm..instead use sprintf or concatenate the string its better you
creating variable first.

$date_order = date ("F j, Y");
$dt = "The order was sent $date_order. Please make a note of it";

The concatenate method is faster then other methods but its difficult
to maintain.
The sprintf() function is slowest among this methods.. its better use
sprintf() if you want format complex string.

Read this : http://www.zend.com/zend/art/mistake.php

---
http://blog.deshot.com
http://www.mastervb.net


Janwillem Borleffs wrote:
> ImOk wrote:
> > or do I have to create a variable first or concatenate the string.
> >
>
> Besides creating a variable first, you have the following options:
>
> $dt = 'The order was sent ' . date('F j, Y') . '. Please make a note of
> it';
>
> $dt = sprintf('The order was sent %s. Please make a note of it', date('F j,
> Y'));
>
>
> JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация