Tag Archives: PHP

mail

It can be used to send email

Example

<?php
$headers    = “MIME-Version: 1.0n”;
$headers   .= “Content-type: text/html; charset=iso-8859-1n”;
$headers   .= “From: from@phpcodez.comn”;
$headers   .= “Return-Path: info@phpcodez.comn”;
$headers   .= “Return-Receipt-To: info@phpcodez.comn”;
@mail(“info@phpcodez.com”,”Test”, “Test Mail”, $headers);
?>

scandir

it lists files and directories of a given path.

Example

<?php
echo “<pre>”;
$dir    = ‘/var/www/test/’;
$files1 = scandir($dir);
print_r($files1);
?>

Output

Array
(
[0] => .
[1] => ..
[2] => index.php
[3] => enc.php
)

dir

It return an instance of the Directory class

Example

<?php
$dir = dir(“/var/www/test/date/”);
echo “Handle: ” . $dir->handle . “<br />”;
echo “Path: ” . $dir->path . “<br />”;
while (($val = $dir->read())  !== false) {
echo $val.”<br />”;
}
$dir->close();
?>

Output

Handle: Resource id #3
Path: /var/www/test/date/
index.php
enc.php
..
.