title: Create a max and min function with loops - PHP
body: <p>i am trying to create a function that takes an array of numbers and, then, 
  returns both the minimum and the maximum number from the given array 
  as an associative array using arrays and for loops.</p>
  
  <p>For example:</p>
  
  <pre><code>$sample = array( 135, 2.4, 2.67, 1.23, 332, 2, 1.02); 
  $output = get_max_and_min($sample); 
  var_dump($output); 
  //$output should be equal to array('max' =&gt; 332, 'min' =&gt; 1.02);*/
  </code></pre>
  
  <p>Here's my code so far:</p>
  
  <pre><code>$sample = array( 135, 2.4, 2.67, 1.23, 332, 2, 1.02); 
      function get_max_and_min($array){
          for($i=0; $i&gt;=$array; $i++){
              echo $i;
          }
      }
  
      $output = get_max_and_min($sample); 
      echo $output;
    /*  var_dump($output); */
  </code></pre>
  
  <p>Any idea? Thanks!</p>