Sr. PHP Programmer Question:
Download Questions PDF

How to create a text file in php?

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?