Optimization in coding style

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 &...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #21 (permalink)  
Old 04-16-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Optimization in coding style

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/

Reply With Quote
  #22 (permalink)  
Old 04-16-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default [OT] Re: Optimization in coding style

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/

Reply With Quote
  #23 (permalink)  
Old 04-16-2005
Micha³ Wo¼niak
 
Posts: n/a
Default Re: Optimization in coding style

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
Reply With Quote
  #24 (permalink)  
Old 04-16-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Optimization in coding style

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/

Reply With Quote
  #25 (permalink)  
Old 04-16-2005
Andy Hassall
 
Posts: n/a
Default Re: Optimization in coding style

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
Reply With Quote
  #26 (permalink)  
Old 04-16-2005
Geoff Berrow
 
Posts: n/a
Default Re: [OT] Re: Optimization in coding style

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/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0