fork(1) download
  1. <?php
  2.  
  3. $a = array("x" => 3, "y" => 2);
  4. $b = array("x" => 5, "y" => 7);
  5.  
  6. function distance ($a, $b) {
  7. return sqrt(($a["x"]-$b["x"])*($a["x"]-$b["x"]) + ($a["y"]-$b["y"])*($a["y"]-$b["y"]));
  8. }
  9.  
  10. print ("Distance between a and b is " . distance($a, $b));
  11.  
  12. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Distance between a and b is 5.38516480713