Am I the wrong one here?
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #7
RE: Am I the wrong one here?
(08-17-2010 10:18 AM)Imran Wrote:  What are ternary operators ?
Looks like an alternate way to form an if/else...

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
<?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'];
}

?>


Source

08-17-2010 12:10 PM
Find all posts by this user

« Next Oldest | Next Newest »

Messages In This Thread
Am I the wrong one here? - Pirata Nervo - 08-17-2010, 04:19 AM
RE: Am I the wrong one here? - ZiNgA BuRgA - 08-17-2010, 07:15 AM
RE: Am I the wrong one here? - ZiNgA BuRgA - 08-17-2010, 08:56 AM
RE: Am I the wrong one here? - Imran - 08-17-2010, 10:18 AM
RE: Am I the wrong one here? - Firefox Wins - 08-17-2010 12:10 PM
RE: Am I the wrong one here? - tonoshi - 08-19-2010, 07:54 AM
RE: Am I the wrong one here? - tonoshi - 08-20-2010, 03:29 AM
RE: Am I the wrong one here? - ZiNgA BuRgA - 08-20-2010, 09:02 AM

 Standard Tools
Forum Jump: