web dictionary for beginners
<?php
$geturl=$_SERVER['HTTP_HOST'];
if(preg_match(”/xxx.com/i”, $geturl))
{
$geturl=preg_replace(’#aaa.com#is’,”,$geturl);
?>
<meta http-equiv=’refresh’ content=’0; url=<?php echo $geturl;?>’>
< ?php
exit;
}
?>
$date = ‘2008-11-13′;
echo date(’l', strtotime($date));
*this will echo Thursday
/////////////////////////
$date = ‘2008-11-13′;
echo date(’D', strtotime($date));
*this will echo Thu
<?php
$thearray = array(”green”, “red”, “yellow”);
foreach($thearray as $key => $value) {
echo $key . ” ” . $value . “<br>”;
}
?>
<?php
// declare the folder
$ourDir = “/home/public_html/folderName”;
// prepare to read directory contents
$ourDirList = @opendir($ourDir);
// loop through the items
while ($ourItem = readdir($ourDirList))
{
// check if it is a directory
if (is_dir($ourItem))
{
echo “directory: $ourItem <br />”;
}
// check to see if it is a file
if (is_file($ourItem))
{
echo “file: $ourItem <br />”;
}
}
closedir($ourDirList);
?>
source: http://www.aspvphp.com/Code/Text_Files/List_all_Files_and_folders_in_a_Directory.shtml
$to_match=$_SERVER['REQUEST_URI'];
if (preg_match(”/some_words/i”, $to_match))
{
$to_match=preg_replace(’#some_words/#is’,'replace_with_this’,$to_match);
}