What is this ?false:true thing?
Look at this code:
$resolve='whatever you want to put here';
$resolve = (preg_match('/false|no|off/i', $resolve))?false:true;
If I var_dump $resolve after this, and it contains the word "false", "no" and/or "off" I get bool(false) Otherwise I get bool(true). How exactly is it doing that, though? What role does "?false:true" play in this?
I want to know what this is, it looks handy.
Last edited by evenstar7139; 07-26-2012 at 12:37 AM.
PS: Please use with moderation, saving it for simple usages where it's easy to read. For more complex cases, a standard and indented if/else block will make your life easier when maintaining your code in the future.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)