5kyy8lu3 Posted February 18, 2009 Share Posted February 18, 2009 Hi. I have an array with numbers in it but they were read in as strings. Because of this I can't seem to get min() and max() to work properly since they aren't decimals. Is there a way to convert the array to a decimal array or something so I can get the min() and max() values in the array? I've tried walking through the array manually but I can't compare values when they're being evaluated as strings :'( Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted February 18, 2009 Share Posted February 18, 2009 PHP's types are incredibly loose and you should be able to use max() and min() on virtually any array, including those that make no sense to use it on, it will cast them to int before checking... Can you show us the code where min() and max() aren't working? Quote Link to comment Share on other sites More sharing options...
5kyy8lu3 Posted February 18, 2009 Author Share Posted February 18, 2009 PHP's types are incredibly loose and you should be able to use max() and min() on virtually any array, including those that make no sense to use it on, it will cast them to int before checking... Can you show us the code where min() and max() aren't working? actually you're absolutely right lol I was looking at the wrong data when comparing it to what my min and max were giving me, i used print_r() to be sure and sure enough i was just being stupid, thanks for the heads up Quote Link to comment 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.