In PHP, you can find the biggest number in an array using the max() function. Here’s an example:
main.php149 chars6 lines
The max() function takes an array as an argument and returns the highest value in that array.
Alternatively, you can also sort the array in descending order using the rsort() function and then grab the first value of the resulting array.
main.php212 chars8 lines
In this example, rsort() is used to sort the array in descending order. We then grab the first value of the resulting array using $numbers[0].
gistlibby LogSnag