How to use Filesystem file get contents in PHP

In this article I am going to explain about file_get_contents function in PHP.
  • 1768

PHP file_get_contents() function

The filesystem file_get_contents function read entire file into a string because it will use memory mapping techniques.

Syntax of file_get_contents  function

file_get_contents(path, includePath, context, start, max_length)

Parameters in file_get_contents  function

It have five parameter:

Parameter Description
path It specifies path to read a file.
includePath IncludePath specifies a search file.
context It specifies the context of the file handle.
start It specifies where in the file to start to read.
max_length It specifies how many byte to read.

Example of filesystem file_get_contents function

<html>

<body>
 

<?php

echo "Orignal File data is :PHP is an HTML-embedded scripting language.";

echo "</br>";

echo "After the use of file_get_contents function the data is:";

$getFile= file_get_contents("C:\wamp\www\Dinesh\PhpIntro.txt",NULL, NULL, 3,12);

echo $getFile;

?>
 

</body>

</html> 


Output:

file_get_contents function.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.