Mega Code Archive

 
Categories / Php / Math
 

Finding the Greatest and Least Values in an Array

<?php   $prices = array(12.95, 24.5, 10.5, 5.95, 7.95);      printf("<p>Highest price: \$%.2f; lowest price: \$%.2f.</p>\n",max($prices, min($prices)); ?>