alex57

02-04-2007, 09:42 PM

hello,

I have three session variables:

$_SESSION['var1'] = "1";

$_SESSION['var2'] = "2";

$_SESSION['var3'] = "3";

If I then wanted to show the lowest numerical value here was 1 I could use:

echo min($_SESSION['var1'], $_SESSION['var2'], $_SESSION['var3']);

The answer would be 1. If I had the three variables again as below and wanted to know the minimum numerical value, the message echoed would be Gary. Why is this? Is there a function which finds the minimum and recognises the strings as strings and not integers? Can you test for a variable type?

Thanks

$_SESSION['var1'] = "1";

$_SESSION['var2'] = "gary";

$_SESSION['var3'] = "peter";

I have three session variables:

$_SESSION['var1'] = "1";

$_SESSION['var2'] = "2";

$_SESSION['var3'] = "3";

If I then wanted to show the lowest numerical value here was 1 I could use:

echo min($_SESSION['var1'], $_SESSION['var2'], $_SESSION['var3']);

The answer would be 1. If I had the three variables again as below and wanted to know the minimum numerical value, the message echoed would be Gary. Why is this? Is there a function which finds the minimum and recognises the strings as strings and not integers? Can you test for a variable type?

Thanks

$_SESSION['var1'] = "1";

$_SESSION['var2'] = "gary";

$_SESSION['var3'] = "peter";