Sr. PHP Programmer Question:

Download Job Interview Questions and Answers PDF

How to create a text file in php?

Senior PHP Programmer Interview Question
Senior PHP Programmer Interview Question

Answer:

$filename = "/home/user/guest/newfile.txt";
$file = fopen( $filename, "w" );
if( $file == false )
{
echo ( "Error in opening new file" ); exit();
}
fwrite( $file, "This is a simple testing global guideline filen" );
fclose( $file );

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
What is the use of final keyword in PHP?Can you create a class in PHP?