Jump to content

what does...


Eugene

Recommended Posts

It's the ternary/tertiary operator (I believe, I can never remember which one or if it's called both).  It's a shorthand IF statement...

[code]
$page = is_numeric($_GET['page']) ? $_GET['page'] : 1;
[/code]

This means if $_GET['page'] is numeric then $page = $_GET['page'].  If it isn't, then $page = 1.

test_condition ? true : false.

HTH

Dest
Link to comment
https://forums.phpfreaks.com/topic/27059-what-does/#findComment-123765
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.