Chapter 7 Answers
The conversion specifier you would use to display a floating-point number is
%f.To take the input string “Happy Birthday” and output the string “**Happy”, you could use a
printfstatement such asprintf("%'*7.5s", "Happy Birthday");.To send the output from
printfto a variable instead of to a browser, you would usesprintfinstead.To create a Unix timestamp for 7:11 AM on May 2, 2016, you could use the command
$timestamp = mktime(7, 11, 0, 5, 2, 2016);.You would use the
w+file access mode withfopento open a file in write and read mode, with the file truncated and the file pointer at the start.The PHP command for deleting the file file.txt is
unlink('file.txt');.The PHP function
file_get_contentsis used to read in an entire file in one go. It will also read a file from across the Internet if provided with a URL.The PHP associative array
$_FILEScontains the details about uploaded files.The PHP
execfunction enables the running of system commands.In XHTML 1.0, the tag
<input type=file name=file size=10>should be replaced with the following syntax:<input type="file" name="file" size="10" />. All parameters must be quoted, and tags without closing tags must be self-closed using/>.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access