I have this simple line:
$images = glob($directory . "*.html");
It returns a list of files like this:
e.g 1
17001400300120110004600.html
17001400300120110004700.html
17001400300120110004800.html
17001400300120110004900.html
17001400300120110005000.html
The problem is that I don't need an ordered list. I need a random list, like this:
e.g 2
17001400300120110004700.html
17001400300120110005000.html
17001400300120110004900.html
17001400300120110004600.html
17001400300120110005800.html
I've tried with NOSORT ( $images = glob($directory . "*.html", GLOB_NOSORT); ) flag but returns an ordered list like in the first example.
How can I get a random list?
shuffle($images);NOSORTis because it uses the order they exist in the directory, which is often the order the files were created, and they were probably created in numerical order.