This is a discussion on Optimization in coding style within the PHP Language forums, part of the PHP Programming Forums category; James Pittman wrote: > R. Rajesh Jeba Anbiah wrote: > > Michal Wozniak wrote: > >>>$string = 'My &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
James Pittman wrote:
> R. Rajesh Jeba Anbiah wrote: > > Michal Wozniak wrote: > >>>$string = 'My "nickname" is '.$myNickName.', what\'s yours?'; > >> > >>Hmmm... I'd say that it's a definetely less readable than: > >>$string="My \"nickname\" is $myNickName, what's yours?"; > >> > >>and if you can use single quotes to surround "nickname": > >>$string="My 'nickname' is $myNickName, what's yours?"; > >> > >>I really like to write readable code. Saves time and hassle. > > His version is much better than yours. Nowadays, I'm annoyed when > > someone uses double quotes:( > > Annoyed? Why? 'coz nowadays, I'm trying to grow up by caring performance and optimization. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
Geoff Berrow wrote:
> I noticed that Message-ID: > <1113477617.109936.233590@l41g2000cwc.googlegroups .com> from R. Rajesh > Jeba Anbiah contained the following: <snip> > > His version is much better than yours. Nowadays, I'm annoyed when > >someone uses double quotes:( > > better not look at any of my code then... Unfortunately, I've already seen your notes;) LOL! BTW, welcome back to the php square. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable R. Rajesh Jeba Anbiah's handwriting: > James Pittman wrote: >> R. Rajesh Jeba Anbiah wrote: >> > His version is much better than yours. Nowadays, I'm annoyed > when >> > someone uses double quotes:( >> >> Annoyed? Why? > > 'coz nowadays, I'm trying to grow up by caring performance and > optimization. > I'd say "d'oh" (note the double quotes). Have you seen the php benchmarks? Do you ALWAYS use the fastest solution? I don't think so. And it that case, the "quotes optimization" is just completely impossible to notice. Cheers Mike |
|
|||
|
Michal Wozniak wrote:
<snip> > > 'coz nowadays, I'm trying to grow up by caring performance and > > optimization. > > I'd say "d'oh" (note the double quotes). Have you seen the php > benchmarks? Do you ALWAYS use the fastest solution? I don't think so. > And it that case, the "quotes optimization" is just completely > impossible to notice. Oh, yes. You're right. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
On Fri, 15 Apr 2005 22:25:51 -0400, "Chung Leong" <chernyshevsky@hotmail.com>
wrote: >"Andy Hassall" <andy@andyh.co.uk> wrote in message >news:rod061dh6enchedtehntud77ls7d83g0ep@4ax.com.. . >> On Fri, 15 Apr 2005 21:40:44 +0100, CJ Llewellyn <cj.llewellyn@gmail.com> >> wrote: >> >> >echo sprintf( >> >> Yay, it's not just me that likes sprintf then :-) >> >> >This code could be very quickly maintained in French, German, Spanish as >> >> Although sprintf for localisation has the main problem that word order >within >> sentences isn't always the same; sprintf doesn't do ordered parameters. > >I thought you can reference the variables supplied to sprintf() by number in >the format string. Not something I have tried tough. Of course it doesn't >help much when you have languages with declensions. Ooh, I didn't know that "As of PHP 4.0.6 the format string supports argument numbering/swapping.". http://uk2.php.net/sprintf <?php $format = "The %2\$s contains %1\$d monkeys. That's a nice %2\$s full of %1\$d monkeys."; printf($format, $num, $location); ?> -- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool |
|
|||
|
I noticed that Message-ID:
<1113629074.257953.318150@l41g2000cwc.googlegroups .com> from R. Rajesh Jeba Anbiah contained the following: >> better not look at any of my code then... > > Unfortunately, I've already seen your notes;) LOL! Uh..thanks :-} My students think I'm wonderful >BTW, welcome back >to the php square. Haven't been away, just busy coding :-) -- Geoff Berrow (put thecat out to email) It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |