AndreasAnemyr Posted April 1, 2013 Share Posted April 1, 2013 (edited) $ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $defaultValue)); is the code above the same as: if(){ } elseif(){ } else{ } That syntax is new flr me... //Andreas Edited April 1, 2013 by AndreasAnemyr (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted April 1, 2013 Share Posted April 1, 2013 Yep, it's called ternary operators. See here for some samples: http://php.net/manual/en/language.operators.comparison.php or here: http://davidwalsh.name/php-shorthand-if-else-ternary-operators have fun! Pascal 1 Link to comment Share on other sites More sharing options...
AndreasAnemyr Posted April 1, 2013 Author Share Posted April 1, 2013 Thx for the links Pascal! Link to comment Share on other sites More sharing options...
PascalVG Posted April 1, 2013 Share Posted April 1, 2013 Glad I could help. Please edit your original Q and add Solved (see my footer) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now