It closes process file pointer
Example
<?php
$pfp = popen(‘/bin/ls’, ‘r’);
pclose($pfp);
?>
It closes process file pointer
Example
<?php
$pfp = popen(‘/bin/ls’, ‘r’);
pclose($pfp);
?>
It returns information about a file path
Example
<?php echo "<pre>"; print_r(pathinfo("test.ini")); ?>
Output
Array
(
[dirname] => .
[basename] => test.ini
[extension] => ini
[filename] => test
)
It parse a configuration string
Example
<?php
echo “<pre>”;
print_r(parse_ini_string(file_get_contents(“test.ini”)));
?>
Output
Array
(
[me] => phpcodez
[first] => http://www.phpcodez.com
)
“test.ini” file content
[names]
me = phpcodez
[urls]
first = “http://www.phpcodez.com”
It parses a configuration file
Example
<?php
echo “<pre>”;
print_r(parse_ini_file(“test.ini”));
?>
Output
Array
(
[me] => phpcodez
[first] => http://www.phpcodez.com
)
“test.ini” file content
[names]
me = phpcodez
[urls]
first = “http://www.phpcodez.com”
It moves an uploaded file to a new location. It is used to validate whether the contents of $_FILES[‘name’][‘tmp_name’] have really been uploaded via HTTP, and also save the contents into another folder.
Example
<?php move_uploaded_file($tmp_name, $_FILES["file"]["name"]) or die("Failed"); ?>
It can be used to create directory
Example
<?php
mkdir(“test/”) or die(“Failed”);
?>
It returns information about a file or symbolic link
Example
<?php
echo “<pre>”;
symlink(‘test.php’, ‘test’);
print_r(lstat(‘test’));
?>
Output
Array
(
[0] => 2049
[1] => 673770
[2] => 41471
[3] => 1
[4] => 33
[5] => 33
[6] => 0
[7] => 8
[8] => 1336807250
[9] => 1336807250
[10] => 1336807250
[11] => 4096
[12] => 0
[dev] => 2049
[ino] => 673770
[mode] => 41471
[nlink] => 1
[uid] => 33
[gid] => 33
[rdev] => 0
[size] => 8
[atime] => 1336807250
[mtime] => 1336807250
[ctime] => 1336807250
[blksize] => 4096
[blocks] => 0
)
It returns information about a link
Example
<?php
echo linkinfo(‘test.txt’);
?>
Output
2049
It creates a hard link
Example
<?php
$target = ‘test.ext’;
$link = ‘test’;
link($target, $link);
echo $link;
?>
Output
test
It changes user ownership of symlink
Example
<?php
$target = ‘test.php’;
$link = ‘test’;
symlink($target, $link);
lchown($link, 8);
?>