Jump to content

[SOLVED] Testing values from an array() ?


Solarpitch

Recommended Posts

Hi,

 

I have the following function that will return an array as it result. The array will contain a series of times.

 

<?php

               $result = check_times();
	foreach($result as $times)
	{

	$theTime = $times[0];

	}


?>

 

What I'm looking to do is check to see if there is a specific time in the array and do something. I've been trying this but it doesn't work..

 

<?php

	if($theTime == "8:00")
	{

	$msg = "Time Reserved";
	$error = 1;
	}

                //I also tried...

	if(in_array("8:00", $theTime))
	{

	$msg = "Time Reserved";
	$error = 1;
	}

?>

Link to comment
https://forums.phpfreaks.com/topic/118780-solved-testing-values-from-an-array/
Share on other sites

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.