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

thanks for the feedback!

 

The program will always assign something to a variable. If there isn't anything to assign, the program will assign null. I need to check if it is null or not.

 

Is there a php statement to do that?

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.

 

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".

Archived

This topic is now archived and is closed to further replies.

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