GLOB in alphabetical order? php

I have a php script that returns the names of some of the pictures in the $webserver directory.

I'm getting the following results with glob:
picture_03.jpg
picture_00.jpg
picture_02.jpg
picture_04.jpg
picture_01.jpg


But I would like it to come out like this:
picture_00.jpg
picture_01.jpg
picture_02.jpg
picture_03.jpg
picture_04.jpg

Is there a way to get this the correct order using GLOB?
$webserver='/home/webmaster/domains/website.com/public_html/media/import';
		   $file_tmp= glob($webserver.$picture.'*.jpg' );

Open in new window

www_puertoricoautoforo_comAsked:
Who is Participating?
 
TiberiuGalCommented:
hi
use natsort on the retuned array

$file_tmp = glob( ... );
natsort($file_tmp);

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.