Reply to Re: short if else

Your name:

Reply:


Posted by Kimmo Laine on 12/28/05 13:17

"Moneypenny" <geld2008@planet.nl> wrote in message
news:43b26e2f$0$10079$ba620dc5@text.nova.planet.nl...
> Hy,
>
> I've got an short ifelse notation, but can give only one action like:
>
> $test == 1 ? $do = true : $do = false;
>
> But this gives an parse error:
>
> $test == 1 ? $do = true $who = "me" : $do = false;
> or
> $test == 1 ? $do = true; $who = "me"; : $do = false;
>


$test==1 ? $do = true : $do = false;
$test==1 ? $who = 'me' : 0 ;

(in this particular case it could be expressed as:
($do = $test==1) ? $who = 'me' : '';
in order to make it really short)

You _could_ do it the way you intended to do it, but that would be bad
coding practise, so I'm not gonna say how.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
antaatulla.sikanautaa@gmail.com.NOSPAM.invalid

[Back to original 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация