Thursday, 15 August 2013

PHP: Implode Comma Separated in min() function

PHP: Implode Comma Separated in min() function

I'm trying to implement the min() function in my PHP code. The min value
should be retried like this:
$ar=array($data[Price]);
echo min($ar);
The problem is that when I echo out $data[Price] I get my prices without
commas nor spaces, so it becomes something like this:
$ar=array($data[Price]);
echo min(373945);
But it should be:
echo min(37, 39, 45);
to get 37.
Is there any way to get comma separated values with implode?
My var_dump result of $data[Price]:
NULL 37.00NULL 39.00NULL 45.00

No comments:

Post a Comment