Jump to content

If statement query in procedural code for now


j.smith1981

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.