Dragosvr92 Posted July 2, 2010 Share Posted July 2, 2010 $string = if ($Statuts == "01") { echo 'Online!' ;} else { echo 'Offline!'; } Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/ Share on other sites More sharing options...
Solution miancu Posted July 2, 2010 Solution Share Posted July 2, 2010 do you mean :like this? $string = ($Statuts == "01")? 'Online!' : 'Offline!' ; Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080495 Share on other sites More sharing options...
Dragosvr92 Posted July 2, 2010 Author Share Posted July 2, 2010 yes ! thats what i meant Thank you Could you please explain me whats the ? and : meaning into it? How dos that replace echo and else ? Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080509 Share on other sites More sharing options...
Pikachu2000 Posted July 3, 2010 Share Posted July 3, 2010 What, exactly, are you trying to have that code do? Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080520 Share on other sites More sharing options...
miancu Posted July 3, 2010 Share Posted July 3, 2010 I hope this will make it easier to understand: http://davidwalsh.name/php-shorthand-if-else-ternary-operators Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080528 Share on other sites More sharing options...
Philip Posted July 3, 2010 Share Posted July 3, 2010 Basically: $var = condition?is_true:is_false; http://us.php.net/ternary#language.operators.comparison.ternary Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080539 Share on other sites More sharing options...
Dragosvr92 Posted July 3, 2010 Author Share Posted July 3, 2010 @pikachu Same thing you do with your if statement in your sig im replacing 01 with online and if not 01 return Offline its saying if the Yahoo User is online or offline no idea how to get the Invisible statuts xD @miancu @King philip Thank You Topic Solved Quote Link to comment https://forums.phpfreaks.com/topic/206575-any-idea-how-may-i-get-this-to-work/#findComment-1080647 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.