Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Jochem Maas
Dylan wrote: Hi Is it possible to use the ($test)?$true:$false construction in a (double quoted) string without dropping out of the string and concatenating? I have many lines like: $var = first part of string .(($a==$b)?$c:$d). rest of string; and I feel it would be more elegant to be able

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Marcus Bointon
On 18 Nov 2005, at 20:13, Dylan wrote: $var = first part of string .(($a==$b)?$c:$d). rest of string; and I feel it would be more elegant to be able to do something like: $var =first part of string {(($a==$b)?$c:$d)} rest of string; Strange as it may seem, you'll probably find that this is

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Chris Boget
and I feel it would be more elegant to be able to do something like: $var =first part of string {(($a==$b)?$c:$d)} rest of string; $templateStr = 'first part of string %s rest of string'; $outputStr = sprintf($templateStr, (($a==$b)?$c:$d)); That is so totally slick! I'm definitely going to

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 09:42, Chris Boget wrote: and I feel it would be more elegant to be able to do something like: $var =first part of string {(($a==$b)?$c:$d)} rest of string; $templateStr = 'first part of string %s rest of string'; $outputStr = sprintf($templateStr,

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Richard Heyes
Robert Cummings wrote: On Mon, 2005-11-21 at 09:42, Chris Boget wrote: and I feel it would be more elegant to be able to do something like: $var =first part of string {(($a==$b)?$c:$d)} rest of string; $templateStr = 'first part of string %s rest of string'; $outputStr =

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:02, Richard Heyes wrote: Readability is in the eye of the beholder. But efficiency isn't ;) Cheers, Rob -- .. | InterJinn Application Framework - http://www.interjinn.com |

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Richard Heyes
Robert Cummings wrote: 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

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Jochem Maas
Richard Heyes wrote: Robert Cummings wrote: On Mon, 2005-11-21 at 10:02, Richard Heyes wrote: Readability is in the eye of the beholder. But efficiency isn't ;) yes it is actually - everything is in the eye of the beholder. it just so happens that we often have consensus ;-) with

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Marcus Bointon
On 21 Nov 2005, at 15:43, Jochem Maas wrote: 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

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:31, Richard Heyes wrote: Robert Cummings wrote: 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

Re: [PHP] using ($test)?$true:$false in a string

2005-11-21 Thread Robert Cummings
On Mon, 2005-11-21 at 10:43, Jochem Maas wrote: Richard Heyes wrote: Robert Cummings wrote: On Mon, 2005-11-21 at 10:02, Richard Heyes wrote: Readability is in the eye of the beholder. But efficiency isn't ;) yes it is actually - everything is in the eye of the beholder. it

[PHP] using ($test)?$true:$false in a string

2005-11-18 Thread Dylan
Hi Is it possible to use the ($test)?$true:$false construction in a (double quoted) string without dropping out of the string and concatenating? I have many lines like: $var = first part of string .(($a==$b)?$c:$d). rest of string; and I feel it would be more elegant to be able to do something

Re: [PHP] using ($test)?$true:$false in a string

2005-11-18 Thread Richard Lynch
On Fri, November 18, 2005 2:13 pm, Dylan wrote: Is it possible to use the ($test)?$true:$false construction in a (double quoted) string without dropping out of the string and concatenating? I have many lines like: $var = first part of string .(($a==$b)?$c:$d). rest of string; and I feel

Re: [PHP] using ($test)?$true:$false in a string

2005-11-18 Thread Dylan
Richard Lynch wrote: On Fri, November 18, 2005 2:13 pm, Dylan wrote: Is it possible to use the ($test)?$true:$false construction in a (double quoted) string without dropping out of the string and concatenating? I have many lines like: $var = first part of string .(($a==$b)?$c:$d). rest of