Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove foreach loop in demo.php #7

Merged
merged 1 commit into from
Sep 19, 2012
Merged

Conversation

BaylorRae
Copy link
Contributor

The glob() function can expand arguments within curly braces. This allows you write the following.

$files = glob('*.{png,jpg,jpeg}', GLOB_BRACE);

The above code will find all files in the current directory that have an image extension without using a foreach loop.

@lucanos
Copy link
Contributor

lucanos commented Sep 19, 2012

Fair call. I would have used a similar solution had I known about it at the time.
I support this Pull Request.

@atlemo
Copy link
Owner

atlemo commented Sep 19, 2012

Cheers.

atlemo pushed a commit that referenced this pull request Sep 19, 2012
Remove foreach loop in demo.php
@atlemo atlemo merged commit ca2f570 into atlemo:master Sep 19, 2012
@BaylorRae
Copy link
Contributor Author

@lucanos the feature is somewhat hidden. I only found it on accident a few months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants