This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP File Handling

PHP readfile() Function

6.1 PHP Dates and Time - Exercises
Started: Feb 12 at 8:06pm
 Question 1 1 pts
Use the correct date function to output the weekday of today (monday, tuesday etc.). Fill in the blank.
echo date("l"); Question 2 1 pts Use the correct format parameter to output a date like this: 2021.01.05. Fill in the blank.
echo date("Y.m.d" ); Question 3 1 pts Use the correct format parameter to output the time like this: 14:08:58 (with hour as a 24-hour format). Fill in the blank. echo date("H.i.s" ); 6. PHP Advanced - Exercises Started: Feb 19 at 2:57am Question 1 1 pts Write a correct syntax to include a file named "footer.php". Fill in the blank. <?php include "footer.php" ;?> Question 2 1 pts Assume we have a file named "webdict.txt", write the correct syntax to open and read the file content. Fill in the blank. echo readfile("webdict.txt") ; Question 3 1 pts Open a file, and write the correct syntax to output one character at the time, until end-of-file. Fill in the blanks. $myfile = fopen("webdict.txt", "r"); while(! feof ($myfile)) { echo fgetc ($myfile); } Question 4 1 pts Create a cookie named "username". Fill in the blank. setcookie ("username", "John", time() + (86400 * 30), "/"); Question 5 1 pts Create a session variable named "favcolor". Fill in the blank. session_start(); ["favcolor"] = "green"; Question 6 1 pts Output the value of the session variable "favcolor". Fill in the blank. echo ; 1829
<?php
echo readfile("include/Module6Quiz.txt");
?>