Jump to content

Archived

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

beaviss

match text and use in if statement

Recommended Posts

Hi,

I need to construct an else elseif statement from plain text I have in an array.

If I know that $filearray[12] could contain the words "available" or "unavailable"

How do I test for this?

I have tried

if ($filearray[12]=="available")
{
echo 'something' ;
}
else
{
echo 'something else' ;
}

but it hasnt proved reliable, as when I know the text is unavailable, it says it is available in the if statement.

What am I doing wrong - how does one effectively test for a match ?

Regards
Anton.

Share this post


Link to post
Share on other sites
that if statement should work. if it's "unreliable" it's because your data is wrong. but if you wanna go balls to the wall you could use === instead of ==

Share this post


Link to post
Share on other sites

×

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.