Re: using ($test)?$true:$false in a string
| From: | Jochem Maas | Date: | Mon, 21 Nov 2005 15:43:26 +0000 |
| Subject: | Re: using ($test)?$true:$false in a string | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226203@lists.php.net to get a copy of this message | ||
Richard Heyes wrote:
Robert Cummings wrote:yes it is actually - everything is in the eye of the beholder. it just so happens that we often have consensus ;-) with regard to the bulldozer metaphor - true that using sprintf() is such a simple case may be excessive BUT I was merely introducing the OP to something new (possibly) - anyone asking such 'simple' questions is not at a stage that this kind of efficiency is an issue (i.e. give them 'whats possible' before telling them 'whats best') the sprintf() example leaves lots of room for creativity and code reuse (even by relative newcomers) or aleast the possiblity of writing more managable code.... Chris Boget liked it anyway :-) PS - Robert Cummings, I totally agree with your general comments on internals@ regarding migration/irritation/etc btw. and if I didn't spend so much time on 'fixing' my working code I might have had time to take a proper look at your InterJinn project - more's the pity that I haven't been able to so far :-/On Mon, 2005-11-21 at 10:02, Richard Heyes wrote:Readability is in the eye of the beholder.But efficiency isn't ;)
Try measuring the difference between the various methods over a realistic number of iterations, eg. 100. There's little point in going through ones code trying to "optimise" these things. Sure you might gain a millisecond here or there, but so what? You'd have to have a *seriously* busy site for that to make a difference.