title: Using Natsort Correctly
body: <p><br>I made this small script to extract names of photos from a directory.</p>
  
  <pre><code>&lt;?php                     
  $dirname = "newspaper_articles/nameofperson/1951-1977/";
  $articlepath = glob($dirname."*.jpg");
  foreach ($articlepath as $article) {
  echo basename($article,".jpg").'&lt;br&gt;';
  }     
  ?&gt;
  </code></pre>
  
  <p>The photos in the directory are named like this;
  <br>1 articletitle.jpg
  <br>2 articletitle.jpg
  <br>11 articletitle.jpg
  <br>12 articletitle.jpg
  <br>21 articletitle.jpg
  <br>22 articletitle.jpg</p>
  
  <p>(Notice the sequence. I wanted php to display it on the page like that)</p>
  
  <p>However my code renders it like this;
  <br>1 articletitle.jpg
  <br>11 articletitle.jpg
  <br>12 articletitle.jpg
  <br>2 articletitle.jpg
  <br>21 articletitle.jpg
  <br>22 articletitle.jpg</p>
  
  <p>What I understand from PHP Manual is that I should use natsort. I'm doing it like this:</p>
  
  <pre><code>foreach ($articlepath as natsort($article))
  </code></pre>
  
  <p>I get an error (Warning: natsort() expects parameter 1 to be array) 
  What would be your take on why this doesn't work</p>