Sr. PHP Programmer Question:

How to create a text file in php?

Tweet Share WhatsApp

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 PDF Read All 202 Senior PHP Programmer Questions
Previous QuestionNext Question
What is the use of final keyword in PHP?Can you create a class in PHP?