Sr. PHP Programmer Question:
Download Job Interview Questions and Answers 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 );
$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 Question | Next Question |
What is the use of final keyword in PHP? | Can you create a class in PHP? |