j.smith1981 Posted January 12, 2011 Share Posted January 12, 2011 I am just wanting to know what the other forms of this type of conditonal would be, the type of if statement is as follows: if ($_POST) {print_r($_POST);} Just seen it a few times now, I know this means if $_POST exists. use the print_r() function to display the entire post array suber global variable. But what are the other combinations other than just if true? Like how are they used like this, like if I wanted to see if a random variable is not identical to another etc. Any helps appreciated, Jez. Link to comment https://forums.phpfreaks.com/topic/224180-if-statement-query-in-procedural-code-for-now/ Share on other sites More sharing options...
Pikachu2000 Posted January 12, 2011 Share Posted January 12, 2011 http://www.php.net/manual/en/language.operators.comparison.php Link to comment https://forums.phpfreaks.com/topic/224180-if-statement-query-in-procedural-code-for-now/#findComment-1158360 Share on other sites More sharing options...
j.smith1981 Posted January 12, 2011 Author Share Posted January 12, 2011 So sorry it will be the 'Ternary Operator' Been going over some indepth OOP and just a bit rusty on this sort of stuff, never used this type of conditional statement before you see. I don't know why that didnt occur to me lol to look at the PHP Manual but anyhow thanks ever so much, Jez. PS I think the reason was I didnt know what to call that kind of if statement but according to this: Another conditional operator is the "?:" (or ternary) operator. All makes it clear to me lol, thanks again. Link to comment https://forums.phpfreaks.com/topic/224180-if-statement-query-in-procedural-code-for-now/#findComment-1158364 Share on other sites More sharing options...
Pikachu2000 Posted January 12, 2011 Share Posted January 12, 2011 The code you posted above doesn't use the ternary operator, though. Link to comment https://forums.phpfreaks.com/topic/224180-if-statement-query-in-procedural-code-for-now/#findComment-1158369 Share on other sites More sharing options...
j.smith1981 Posted January 12, 2011 Author Share Posted January 12, 2011 Ah yes I know lol. Will go through the manual though for if statements and get myself sorted, no problems. Thanks ever so much for bearing with me, been going over some of the finer points that I really just couldn't get beforehand when doing PHP. I get completely the standard if statements if you like with the curly braces but the ones where its like the one I just quoted I couldn't understand. But been going through some other topics so I can really get this nailed too, before I advance further in OOP, hit somethings I really want to get into my head, its all good. Thanks again, Jez. Link to comment https://forums.phpfreaks.com/topic/224180-if-statement-query-in-procedural-code-for-now/#findComment-1158377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.