title: array_shift and print_r behaving wierd in PHP
body: <p>I wanted to test <code>array_shift</code> on a simple example:</p>
  
  <pre><code>$a = ['a', 'b', 'c', 'd'];
  $rem = array_shift($a);
  print_r($rem);
  </code></pre>
  
  <p>Which only returns me: <code>a</code>, instead of an array of: <code>['b', 'c', 'd']</code>.</p>
  
  <p><a href="https://www.php.net/manual/en/function.array-shift.php" rel="nofollow noreferrer">php.net</a> docs on <code>array_shift</code> state the following:</p>
  
  <blockquote>
    <p>array_shift() shifts the first value of the array off and returns it,
    shortening the array by one element and moving everything down. All
    numerical array keys will be modified to start counting from zero
    while literal keys won't be affected.</p>
  </blockquote>
  
  <p>This function is supposed to remove the first element and return all the rest with re-ordered keys.</p>
  
  <p>Now, I copied the example from the docs site as is (tried with both <code>[]</code> and <code>array()</code>):</p>
  
  <pre><code>$stack = ["orange", "banana", "apple", "raspberry"];
  $fruit = array_shift($stack);
  print_r($stack);
  </code></pre>
  
  <p>Now this returns as expected:</p>
  
  <pre><code>Array
  (
      [0] =&gt; banana
      [1] =&gt; apple
      [2] =&gt; raspberry
  )
  </code></pre>
  
  <p>I don't understand what just happend here or what I did wrong.</p>
  
  <p>My example only differs in variable names and elements in the array.</p>
  
  <p>And I <strong>hardly</strong> don't believe the issue would be because of my usage of single-quotes <code>'</code>.</p>
  
  <p>Also, here is a <a href="http://sandbox.onlinephpfunctions.com/code/9cd2c7e1e25020d23934b9faba1a4bdbeffa17b3" rel="nofollow noreferrer">demo on Sandbox</a>.</p>