title: Array_reverse "again"
body: <p>This is my first post, so please be indulgent/lenient.</p>
  
  <p>This array is steps enumeration of an embroidery program</p>
  
  <p>And I have to keep "0" values between not null steps and to do not take null values after</p>
  
  <pre><code>$oldArray = Array
  ("1278","1297","1278","1000","0","1000","1212","1001","1212","1278","1000",
  "0","1297","1001","1000","0","1001","1278","1000","1001","1001","1278", 
  "0","1000","1001","0","0","0","0","0","0","0","0","0","0",
  "0","0","0","0","0","0","0","0","0","0","0","0","0","0"
  );
  </code></pre>
  
  <p>I reverse it a first time and find the first not null value :</p>
  
  <pre><code>$arrayReversed = array_reverse($oldArray);  
  
  $lastKey = 48;
  
  foreach ($arrayReversed as $key =&gt; $value) {
      # If the value is not empty 
      if (!empty($value)) {
  </code></pre>
  
  <blockquote>
    <p>[FR] -> remplir un nouveau tableau avec les valeurs en partant de l'index "$key" jusqu'a "$lastKey"</p>
    
    <p>[ENG] -> fill a new array with values starting from the first key with not null value to the last key
    <strong>Edit : Here was my error</strong></p>
  </blockquote>
  
  <pre><code>        $sequencesFromEnd[] = array_slice($arrayReversed,$key,$lastKey);
  </code></pre>
  
  <blockquote>
    <p>I have it corrected with this code :</p>
  </blockquote>
  
  <pre><code>        $sequencesFromEnd = array_slice($arrayReversed,$key,$lastKey);
          break;
  
      }
      $key++;
  }
  </code></pre>
  
  <p><strong>Edit : Then It works like I've expected !</strong></p>
  
  <p>Then I want to <strong>Reverse "again"</strong> the array with values <strong>for have steps in the right order</strong> and this code is not working :</p>
  
  <pre><code>//First try
  
  $stepsInRightOrder = array_reverse($sequencesFromEnd);
  
  // Second try
  
  //array_reverse($stepsInRightOrder);
  </code></pre>
  
  <blockquote>
    <p>Second try commented because it is a no-op. </p>
  </blockquote>
  
  <p>Unfortunately, <strong>the array stay like it is implemented</strong> in the "foreach" loop ... </p>
  
  <p>Thanks a lot by advance !!</p>