Jump to content

[SOLVED] Only for PHP Masters (not me)


TheFilmGod

Recommended Posts

Assuming you are doing a quizzy type thing (good technical language there :P), which you may not be. Not Null wouldn't be right because they could answer with anything that isn't nothing and thus get it correct :P

 

Say the answer the $a1 was 42 (who knows the question? =P) then you'd do:

 

if ($a1 == 42) {

echo "You are the php master!!";

}
else {

echo "Unfortunately you got that one wrong..";

}

 

Or if the answer was forty two (word form/textual answer):

 

if ($a1 == "forty two") {
echo "You are the php master!!";

}
else {

echo "Unfortunately you got that one wrong..";

}

 

Hope that helps?

 

Sam

Link to comment
Share on other sites

The previous reply is really good but... in front of me I have a php book that gives me a set of different functions to check if it's null.

 

Won't the function isset() work too? What about is_null(), or empty()?

 

Which is the best in this situation. They all seem to do the same thing in my situation.

Link to comment
Share on other sites

 

isset is when a varable holds anythink or has been set...

 

$redarrow=""; << isset beleve or not.....

 

$redarrow="$redarrow"; << isset defently.....

 

$redarrow  << not set no =  or " " condition

 

Yes I realize this. I pull my data out of mysql. If there isn't anything there the php code pulls out "NULL".

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.