I have a directory of images with filenames 0.jpg, 1.jpg, 2.jpg … 10.jpg, etc., and the regex would match /0\.jpg/ with 10.jpg. Because of this, it would only fetch a subset of the images in the directory (i.e., the images in the $all_images array between 0.jpg and 10.jpg), as this loop breaks when it matches with any filename that ends in 0.jpg instead of exactly 0.jpg.
I have a directory of images with filenames
0.jpg
,1.jpg
,2.jpg
…10.jpg
, etc., and the regex would match/0\.jpg/
with10.jpg
. Because of this, it would only fetch a subset of the images in the directory (i.e., the images in the$all_images
array between0.jpg
and10.jpg
), as this loop breaks when it matches with any filename that ends in0.jpg
instead of exactly0.jpg
.