title: How to get first non zero value and last non zero value indexes in array?
body: <p>Ok So I have an PHP array of data like the following </p>
  
  <pre><code>0
  0
  0
  0
  0
  0
  500 // Get index of this value which is 6
  11000
  100
  110
  221
  1245
  2141// Get index of this value which is 12
  0
  0
  0
  0
  0
  </code></pre>
  
  <p>Is there a PHP function that would grab the <strong>first Non-Zero Value index</strong> and the <strong>last Non-Zero value index</strong>? Or a very beautiful way to do it?</p>
  
  <p>I know I can do this with a few <code>IF</code> statements, but it will become very messy.</p>