To find the midpoint between two points in PHP, you can use the following function:
main.php147 chars8 lines
This function takes in two points, $p1 and $p2, as associative arrays with 'x' and 'y' keys. It then calculates the midpoint between the two points using the midpoint formula:
main.php29 chars2 lines
Finally, it returns the midpoint as an associative array with 'x' and 'y' keys.
Here is an example usage of the function:
main.php302 chars8 lines
gistlibby LogSnag