Home Tutorial Php Phpfiles PHP glob() Function and example

 
 

Share on Google+Share on Google+
PHP glob() Function and example
Posted on: October 30, 2009 at 12:00 AM
Advertisement
This segment of the PHP tutorial illustrates the use of file handling function glob() and its example

Syntax

array glob (pattern [, int $flags = 0 ] )

It matches the file and directories with the given pattern in the given path.
After matching with the given pattern it  gives  an array consisting of files and  directories


Code for glob() Function using in PHP Program

<?php
    $ar1
=glob("*.txt");
    foreach
($ar1 as $k=>$v )
       {
     echo
"<br>$k--->$v";
      }
?>

Output
0--->aa.txt
1--->bb.txt
2--->roseindai.txt
3--->roseindia.txt

Advertisement

Related Tags for PHP glob() Function and example:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com