FileSystem Function in PHP: Part 14

Introduction

In this article I describe the PHP FileSystem functions link, link_info, Istat  and mkdir. To learn some other FileSystem functions, go to:

  1. FileSystem Function in PHP: PART 1
  2. FileSystem Function in PHP: PART 2
  3. FileSystem Function in PHP: PART 3
  4. FileSystem Function in PHP: PART 4
  5. FileSystem Function in PHP: PART 5
  6. FileSystem Function in PHP: PART 6
  7. FileSystem Function in PHP: PART 7
  8. FileSystem Function in PHP: PART 8
  9. FileSystem Function in PHP: PART 9
  10. FileSystem Function in PHP: PART 10
  11. FileSystem Function in PHP: PART 11
  12. FileSystem Function in PHP: PART 12
  13. 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

link_ifo(path)

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

link_ifo(path)

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

link-info-function-in-php.jpg

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

Istat(file)

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


istat-function-in-php.jpg

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");
?>


Similar Articles