isset($_COOKIE[""])) ? $_COOKIE[""]+2 : 0; Can others please translate what this says? I don't know what '?' question mark with this means in PHP. Thanks a lot.
I know this is, isset($_COOKIE[""])) check to see if cookie is set. I don't know what the rest of this with it means after searching everywhere. Thank you.
isset($_COOKIE[""])) ? $_COOKIE[""]+2 : 0; PHP: All I said was what does this mean? It does something, I just want to know what it means by you that know PHP code. Because I'm trying to understand what it means so I know if I still need it. I'm only asking something easy, what does it mean? Thank you very much for your help.
It is the ternary condition operator, read about it here: http://php.net/manual/en/language.expressions.php
Hi, When you're not used to it, it can look quite odd.. using this code as an example: $var = ""; echo (trim($var)=="") ? "empty" : "not empty"; $var = "a"; echo (trim($var)=="") ? "empty" : "not empty"; Code (markup): basically on the first pass, the $var is empty, the echo will output 'empty', on the next one it will output 'not empty' thats a really simple view, it can be used for more complex functionality, as per your sample. in your sample, there would be a cookie name in the double quotes that you've removed, lets call it VisitorCount for this example. Assuming that the cookie has never been set, so perhaps a first visit -> then 0 will be used or returned, depending upon the earlier part of the line that not shown. Ok, assuming that the cookie is already set, so perhaps a returning visit, say it has a value of 9 -> then the value used or returned would be cookie-value+2, so 11 Hope that helps? Si