An unfamilar if statement

#1
[eluser]ranjudsokomora[/eluser]
Hello CI Coders,
I think this is an easy one, I just need some pointers. I was looking at modifying the router.php file, and stumbled across this code:
Code:
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;

I don't know what the
Code:
? array() : $route

Means, could someone explain or link me documentation on what the question mark, and colon mean?

Thanks

#2
[eluser]danmontgomery[/eluser]
That's the ternary operator.

http://en.wikipedia.org/wiki/?:

Code:
echo ( $val == TRUE ? 'true' : 'false' );

// Same as

if($val == TRUE)
    echo 'true';
else
    echo 'false';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.