mwl707 Posted June 28, 2009 Share Posted June 28, 2009 Can somebody help me please , Can I use a variable with the MIN function in php? I have altered the code slightly so it is more universal but it is a bit like $strings = "2,4,8,76,2,4,3,5" ; $result = min($strings) ; echo " Min result is $result " ; I have tried encapsulating the $strings variable with " and ' but still no result Can anyone offer some advice please ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/163984-solved-help-with-min/ Share on other sites More sharing options...
wildteen88 Posted June 28, 2009 Share Posted June 28, 2009 min expects an array. Change this line $result = min($strings) ; to $result = min(explode(',', $strings)) ; Quote Link to comment https://forums.phpfreaks.com/topic/163984-solved-help-with-min/#findComment-865077 Share on other sites More sharing options...
mwl707 Posted June 28, 2009 Author Share Posted June 28, 2009 Thanks , Worked a treat ! Mick Quote Link to comment https://forums.phpfreaks.com/topic/163984-solved-help-with-min/#findComment-865083 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.