ch7 questions Flashcards
Which printf conversion specifier would you use to display a floating-point number?
%f
What printf statement could be used to take the input string “Happy Birthday” and output the string “**Happy”?
printf(“%’*7.5s”, “Happy Birthday”);
To send the output from printf to a variable instead of a browser, what alternative function would you use?
sprintf()
How would you create a Unix timestamp for 7:11 a.m. on May 2, 2016?
$timestamp = mktime(7,11,0,5,2,2016);
Which file access mode would you use with open to open a file in write and read mode, with the file truncated and the file pointer at the start?
fopen(“file.txt”, ‘w+’);
What is the PHP command for deleting the file file.txt?
unlink(‘file.txt’);
Which PHP function is used to read an entire file in one go, even from across the web?
file_get_contents();
Which PHP superglobal variable holds the details on uploaded files?
$_FILES
Which PHP function enables the running of system commands?
exec
Which of the following tag styles is preferred in HTML5: <hr> or <hr>?
<hr></hr>