Complete the code to open a file for reading only.
<?php $file = fopen('example.txt', '[1]'); ?>
The mode 'r' opens the file for reading only.
Complete the code to open a file for writing and truncate it if it exists.
<?php $file = fopen('example.txt', '[1]'); ?>
The mode 'w' opens the file for writing and truncates it if it exists.
Fix the error in the code to open a file for appending.
<?php $file = fopen('example.txt', '[1]'); ?>
The mode 'a' opens the file for appending, writing data at the end.
Fill both blanks to open a file for reading and writing without truncating.
<?php $file = fopen('example.txt', '[1][2]'); ?>
The mode 'r+' opens the file for reading and writing without truncating it.
Fill all three blanks to open a file for writing and reading, creating it if it doesn't exist.
<?php $file = fopen('example.txt', '[1][2][3]'); ?>
The mode 'x+' opens the file for writing and reading, creates it if it doesn't exist.
