Jump to content

Archived

This topic is now archived and is closed to further replies.

Maverickb7

Skip First Two Items in Array

Recommended Posts

How can I skip the first two items in an array. I'm trying to display a bunch of images within a directory by grabbing all the file names with php. Before the image files it shows . and .. so i'm wondering how I can remove them.

Share this post


Link to post
Share on other sites
how would I use that to skip the first two items in an array? I tried to look it up on the net through google but it didn't really bring up any results that explained what I wanted.

Share this post


Link to post
Share on other sites
http://ca.php.net/manual/en/function.glob.php

You can check the user notes for examples.

Share this post


Link to post
Share on other sites
ok i'm useless.. can someone give me an example of how to do this.. i still can't figure it out by reading those pages.

Share this post


Link to post
Share on other sites
Don't put the . and .. in the array to start with.

And if you want an example,

http://www.php.net/readdir

Share this post


Link to post
Share on other sites
[quote author=Maverickb7 link=topic=111014.msg451166#msg451166 date=1160691714]
yes. I'm trying to display image files.
[/quote]
$images = glob("/images/{*.jpg,*.gif, *.png}", GLOB_BRACE);

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.