mysql - Simple PHP warning question? -
I was thinking how I can correct this warning I am listed below.
I'm using PHP & amp; MySQL
WARNING: Min () [function.min]: The array must contain at least one element
Here is a part of the code that I Seems problem
$ tag = tag_info ($ link); $ Minimum_count = minutes (array_values ($ tag)); $ Maximum_ count = maximum (array_values ($ tag)); $ Spread = $ max_mount - $ minimum_count;
I needed to post the whole code, but some ignorant users would probably feel a duplicate question, if you need to see the complete code, please thank you for the previous questions.
Well, I do not understand this piece of code because everybody code is not displaying anything, but getting rid of the warning. You can see the full code here
$ tag = tag_info ($ link); $ Spread = $ tag? Maximum ($ tag) - minimum ($ tag): 0;
This code is valid, as long as your tag_info () function returns an array.
PHP's built-in array_values () function is useless, since the minimum () and maximum () both ignore the key in an array.
Comments
Post a Comment