Jump to content

If variable = anything within an array?


r00ttap

Recommended Posts

How would I go about checking if a variable equals anything within an array.

 

For instances:

 

$array = ('2009-06-01', '2009-06-02', '2009-06-20', '2006-06-25');
$today = "2009-06-20";

if($today = $array) {
     echo "Today was found within the array";
}

 

I know that won't work but it's what I'm looking to accomplish.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/162798-if-variable-anything-within-an-array/
Share on other sites

Actually I'm going to ask another question that relates to this one. How does one set a while loop results as an array?

 

$dateSelect = "SELECT dates FROM dates_table";

cancelDates = array();
while($row=mysql_fetch_assoc($dateSelect)) 

 

I basically want the dates to be set as an array.

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.