php glob() function - how to get filenames by specific pattern in php

php glob() function - how to get filenames by specific pattern in php


globFunction.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>php glob() function - how to get filenames by specific pattern in php</title>
</head>

<body>
    <h2 style="color:OrangeRed; font-style:italic">
     php glob() function example:<br /> how to get filenames by specific pattern
    </h2>
    <hr width="530" align="left" color="Orange" />
    <br />

<?php
 echo "<font style=color:Green>all .txt files: </font>";
 print_r(glob("*.txt"));

 echo "<br /><br />";
 echo "<font style=color:Green>all .php files: </font>";
 print_r(glob("*.php"));
?>
</body>
</html>