Skip to content

Instantly share code, notes, and snippets.

@rnarian
Last active August 29, 2015 13:56
Show Gist options
  • Save rnarian/9226841 to your computer and use it in GitHub Desktop.
Save rnarian/9226841 to your computer and use it in GitHub Desktop.
PHP Shorthand if/else
$is_admin = ($user['permissions'] == 'admin' ? true : false);
echo 'Welcome '.($user['is_logged_in'] ? $user['first_name'] : 'Guest').'!';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment