Introduction
In this article I describe the PHP FileSystem functions link, link_info, Istat and mkdir. To learn some other FileSystem functions, go to:
- FileSystem Function in PHP: PART 1
- FileSystem Function in PHP: PART 2
- FileSystem Function in PHP: PART 3
- FileSystem Function in PHP: PART 4
- FileSystem Function in PHP: PART 5
- FileSystem Function in PHP: PART 6
- FileSystem Function in PHP: PART 7
- FileSystem Function in PHP: PART 8
- FileSystem Function in PHP: PART 9
- FileSystem Function in PHP: PART 10
- FileSystem Function in PHP: PART 11
- FileSystem Function in PHP: PART 12
- FileSystem Function in PHP: PART 13
PHP link() Function
The PHP FileSystem link function creates a hard link and it returns true on success or false on failure.
Syntax
Parameter in link function
The parameter of the function is:
Parameter |
Description |
path |
It specifies the path to check. |
Example
An example of the function is:
<?php
$target = 'test1.ext'; // This is the file that already exists
$link = 'test2.ext'; // This the filename that you want to link it to
link($target,$link);
?>
PHP link_info Function
The PHP FileSystem link function is used to get the information about a link; it basically returns the information about a hard link.
Syntax
Parameter in link_info function
The parameter of the function is:
Parameter |
Description |
path |
It specifies the path to check. |
Example
An example of the function is:
<?php
echo linkinfo('source.ext');
?>
Output
PHP Istat() Function
The PHP FileSystem Istat function gives information about a file or symbolic link or say it returns the information about a file or symbolic link.
Syntax
Parameter in Istat function
The parameter of the function is:
Parameter |
Description |
file |
It specifies the file to check. |
Example
An example of the function is:
<?php
$var=lstat("test.txt");
foreach($var as $k=>$v )
{
echo "<br>$k--->$v";
}
?>
Output
PHP mkdir() Function
The PHP FileSystem mkdir function makes a directory and it returns true on success and false on failure.
Syntax
mkdir(path,mode,recursive,context) |
Parameter in mkdir function
The parameter of the function is:
Parameter |
Description |
path |
It specifies the name of the directory to create. |
mode |
It specifies permission only. |
recursive |
It specifies if the recursive mode is set. |
context |
It specifies the context of the file handle. |
Example
An example of the function is:
<?php
mkdir("sharad");
?>