title: How to get an input from a user and bubble sort that input?
body: <p>I'm new to php, I'm trying to create a program that asks the user for number of elements, then input these elements, then bubbles sort them.</p>
  
  <pre><code>&lt;?php
    function bubbleSort(array $arr)
  {
      $n = sizeof($arr);   
      for ($i = 1; $i &lt; $n; $i++) {
          $flag = false;
          for ($j = $n - 1; $j &gt;= $i; $j--) {
              if($arr[$j-1] &gt; $arr[$j]) {
                  $tmp = $arr[$j - 1];
                  $arr[$j - 1] = $arr[$j];
                  $arr[$j] = $tmp;
                  $flag = true;
              }
          }
          if (!$flag) {
              break;
          }
      }
  
      return $arr;
  }
  
  // Example:
  $arr = array(255,1,'a',3,45,5);
  $result = bubbleSort($arr);
  print_r($result); 
  ?&gt;
  </code></pre>
  
  <p>My code works fine if I store the array, What I'm trying to do is to ask the user for the input instead of storing it in the code. Can anyone help me out of how to ask the user of how many elements needed and then input these elements?  </p>