Display first image in an array

I am using the following function to display all the images in an array on a page. In a separate scenario I would like to be able to display only the first image in the array. How would I modify this function.

[embed=425,349]$array=glob(‘images/size_2/*’);
foreach($array as $v){
echo ‘

’;
}[/embed]

Thanks in advance for any help you can offer

You would need to create a new function that does what you want. The snippet of function you posted, that doesn’t appear it would work anyways, has it’s purpose. You need another function that serves the new purpose.

To display only the first array object (aslong as your keys are numeric)

[php]echo ‘

’;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service