To find the range of a list of numbers in PHP, you can use the max and min functions to find the largest and smallest values, and then subtract them to get the range. Here's an example code:
main.php123 chars4 lines
This code creates an array of numbers and then calculates the range by subtracting the smallest value (2) from the largest value (9). The result is then echoed out to the screen. You can substitute your own array of numbers for the $numbers variable to calculate the range of your own data.
gistlibby LogSnag