if (is_string($resolve)) { $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-25-2012 at 11:37 PM.
The better I get at programming, the more I appreciate arrays. Handy dandy things they are.
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
Bookmarks