Chapter 5
Which of the following consists of the PHP files that represent the data of the applications? a. model b. requester c. inheriter d. controller
a. model
When you ________________ a request, all processing takes place on the server. a. forward b. demand c. initiate d. Cancel
a. Forward
function get_product($product_id) { global $db; $query = 'SELECT * FROM products WHERE productID = :product_id'; $statement = $db->prepare($query); $statement->bindValue(':product_id', $product_id); $statement->execute(); $product = $statement->fetch(); $statement->closeCursor(); return $product; } (Refer to code example 5-1) Which of the following is a proper PHP statement for calling the function in this example. a. $product = $get_product(product_id); b. $product = get_product($product_id); c. $product = $get_product($product_id); d. $product = get_product(product_id);
b. $product = get_product($product_id);
To make a variable that is declared outside of a function usable inside the PHP function, which keyword can be used? a. public b. global c. local d. module
b. global
Which of the following consists of the PHP and HTML files that represent the user interface of an application? a. logic b. view c. model d. classes
b. view
Which function can be used to redirect a request to another URL? a. require() b. response() c. header() d. include()
c. header()
Which function can be used to forward a request from one PHP file to another? a. return() b. response() c. include() d. location()
c. include()
One reason for using the header() function to redirect a request a. is that it's more efficient than forwarding a request b. is to reduce the number of round trips that are required c. is to have a PHP file run itself again d. is to do all processing for the request on the server
c. is to have a PHP file run itself again
When creating a function, ________________ can be included in the parentheses that follow the name. a. controllers b. formatters c. properties d. parameters
d. parameters
Which type of statement should be included if the function should send a value back to where the function was called? a. send b. parameter c. argument d. return
d. return