title: How to delete items from global array with a function in PHP
body: <p>How do I delete an item inside an array using a PHP function? I have tried the following but the array remains unaffected:</p>
  
  <pre><code>&lt;?php
  
  $fruits = ["banana", "apple", "kiwi", "pear"];
  
  function deleteFromArray($arr) {
      unset($arr[0]);
      $arr = array_values( $arr );
  }
  
  deleteFromArray($fruits);
  
  var_dump($fruits);
  // returns the array without any changes...
  </code></pre>