Re: [PHP] If statement within a variable?
$var=Hello.(($var==1)? Mr. Bean:New Comer).To somewhere; Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS - Original Message - From: Brandon Orther [EMAIL PROTECTED] To: PHP User Group [EMAIL PROTECTED] Sent: Thursday, August 30, 2001 6:59 PM Subject: [PHP] If statement within a variable? Hello, Is there a way to put an if statement in a variable? For example: $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. To The Coffee House.; Thank you, Brandon Orther -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
$var = $var2==1 ? 'Hello Mr. Bean' : 'Hello New Comer'; be careful of your if statements and only using one equals.. jack Brandon Orther wrote: Hello, Is there a way to put an if statement in a variable? For example: $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. To The Coffee House.; Thank you, Brandon Orther -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
Original message From: Brandon Orther [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 08:59:44AM -0700 Message-ID: 006301c1316c$c9395010$0a00a8c0@webintel Subject: [PHP] If statement within a variable? Hello, Is there a way to put an if statement in a variable? For example: $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. To The Coffee House.; Thank you, Brandon Orther /Original message Reply This is it: $var = Hello.($var2 = 1 ? Mr. Bean : New Comer).To The Coffee House.; /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
Brandon Orther wrote: Hello, Is there a way to put an if statement in a variable? For example: $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. To The Coffee House.; $var = Hello .($var2==1 ? Mr. Bean : New Comer); /franklin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
Original message From: * RzE: [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 06:05:57PM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] If statement within a variable? This is it: $var = Hello.($var2 = 1 ? Mr. Bean : New Comer).To The Coffee House.; /Original message Reply Oops... copying your code I also copied an error. It should be $var2 == 1 io $var2 = 1. So your check will be: $var = Hello.($var2 == 1 ? Mr. Bean : New Comer).To The Coffee House.; /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
So sprach »Brandon Orther« am 2001-08-30 um 08:59:44 -0700 : $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. $var = Hello . (($var2 = 1)?(Mr. Bean):(New Comer)); But why do you assign 1 to $var2? To circumvent these kind of problems, I always write: $var = Hello . ((1 == $var2)?(Mr. Bear):(New Comer)); Or, in this case, you could have used: $var = Hello; if (1 == $var2){ $var .= Mr. Bean; } else { $var .= New Comer; } Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 1 day 3 hours 15 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]