Click here to Skip to main content
15,921,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i think there is no need to use this , in below code .

PHP
<?
                    $slides =array();
                    //$filePath='directorypath/';
                    $dir = opendir($directory1);
                     while ($file = readdir($dir)) {
                      if (eregi("\.png",$file) || eregi("\.jpg",$file) || eregi("\.gif",$file) ) {
                      $slides[] = $file;

                      }
                       }

                       while (sizeof($slides) != 0 ){

                         $img = array_pop($slides);
                        echo '<li>';
                        echo "<img src='$directory1/$img'  />";

                          }


                       ?>
Posted
Updated 6-Feb-12 18:42pm
v2

1 solution

array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Will additionally produce a Warning when called on a non-array.

this is taken from: http://php.net/manual/en/function.array-pop.php[^]
 
Share this answer
 
Comments
pritamsp 7-Feb-12 0:43am    
thanks a lot.
CRDave1988 7-Feb-12 0:45am    
welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900