Ternary Operator

Like this:

<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
   $action = 'default';
} else {
   $action = $_POST['action'];
}

?>

This kind of thing works in all “C-like” languages right? (JavaScript, PHP, etc.)

More info.

If/Then/Else statments are a type of Control Structure: Wikipedia, PHP docs.

Comments

Nothing to see here yet. Start things off, why don't you?

What do you think about that?

Elsewhere in the empire: Home, Blog, APOD