Jump to content

Find lowest value within session arrays using Min()


oddball25

Recommended Posts

Hi

 

I am having trouble using the min() function to find the lowest value within my session arrays.

 

On my site i have the following car values saved into my $car array:

 

$car = array(
"itemNumber" => $itemNumber,		  		  
"Model" => $Model,		  
"EngineSize" => $EngineSize,
"Colour" => $Colour,	
"Value" => $Value,
);

 

I then store each $item array into a $_SESSION['all'] as below:

 

if (isset($_SESSION['all'])) {
$_SESSION['all'][$number] = $car;
} else {
$_SESSION['all'] = array($number => $car);
}

 

Now i need to find the lowest Value of all the cars that the user may add. I have been using the min() function to try and do this with the following code but it gives me the error:

 

Wrong parameter count for min().....

 

$cheapest = min($car['Value']);

 

Am i on the right tracks or is this not possible? If anyone could shed some light on how i can get this to work, would be very much appreciated!

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.