0
$pictures = glob(path('public') . 'uploads/galleries/' . $dir_name . '/' . '*.jpg');

Right now it only retrieves .jpg files from a directory. However, I want it to be retrieving .JPG, .png, .PNG or others too.

I wonder if *.jpg can be used like; *.jpg|*.JPG|*.png|*.PNG or if I can attach a regex which basically does the same thing.

If glob() doesn't support such use, what would you suggest for this task?

1 Answer 1

2

Use curly braces:

'*.{jpg,JPG,png,PNG}'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.