monkeytooth Posted October 21, 2010 Share Posted October 21, 2010 $_GET['id'] = (empty($_GET['id'])) ? 0 : $_GET['id']; I'm going over someones code, the site is super flawed, Ive got to much going on at once and I can't wrap my head around that. Is it if the string is empty or 0 then use the get variable or is it something else? Link to comment https://forums.phpfreaks.com/topic/216437-what-does-this-type-of-statement-mean/ Share on other sites More sharing options...
marcus Posted October 21, 2010 Share Posted October 21, 2010 It's a ternary operator. It's a condensed if statement practically. $var = (CONDITIONAL STATEMENT) ? TRUE : FALSE; Link to comment https://forums.phpfreaks.com/topic/216437-what-does-this-type-of-statement-mean/#findComment-1124700 Share on other sites More sharing options...
trq Posted October 21, 2010 Share Posted October 21, 2010 It is the ternary operator and is basically a short version of if else. if (empty($_GET['id'])) { $_GET['id'] = 0; } else { $_GET['id'] = $_GET['id']; } Link to comment https://forums.phpfreaks.com/topic/216437-what-does-this-type-of-statement-mean/#findComment-1124701 Share on other sites More sharing options...
monkeytooth Posted October 21, 2010 Author Share Posted October 21, 2010 Thats what I thought, I dont typically use statements like that so I wanted to double check with people here, thanks Link to comment https://forums.phpfreaks.com/topic/216437-what-does-this-type-of-statement-mean/#findComment-1124706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.