The ________ function in PHP can be used to check if a certain function exists.
- function_exists()
- is_function()
- check_function()
- function_check()
The 'function_exists()' function in PHP checks if a certain function exists in the current script, which is useful for ensuring a function is available before calling it to prevent errors.
What is the main difference between a LEFT JOIN and a RIGHT JOIN in SQL?
- LEFT JOIN returns unmatched rows from the left table, RIGHT JOIN from the right table
- LEFT JOIN returns all rows from both tables, RIGHT JOIN only matching rows
- LEFT JOIN and RIGHT JOIN are the same, just synonyms for the same operation
- LEFT JOIN is used for numeric data, RIGHT JOIN for text data
The main difference between a LEFT JOIN and a RIGHT JOIN in SQL is that a LEFT JOIN returns all the rows from the left table and the matched rows from the right table, including unmatched rows from the left. In contrast, a RIGHT JOIN returns all the rows from the right table and the matched rows from the left table, including unmatched rows from the right.
Which keyword is used in PHP to handle exceptions?
- throw
- try
- catch
- finally
In PHP, the catch keyword is used to handle exceptions. It is used to catch and manage exceptions that are thrown in the try block.
What type of network is best suited for connecting devices in a single building or floor?
- LAN
- WAN
- PAN
- MAN
LAN (Local Area Network) is a network type that is designed to operate over a small physical area such as an office, building, or a group of buildings. It allows devices to connect and communicate within a localized environment.
When processing multiple uploaded files in PHP, the $_FILES superglobal uses the format $_FILES['file']['property'][index], where 'property' can be ________ to get the type of the file.
- 'type'
- 'name'
- 'size'
- 'tmp_name'
The correct option is 'type.' When dealing with multiple uploaded files, accessing the 'type' property of the $_FILES array is essential for identifying the file type of each uploaded file. This is important for validation and processing.
You're creating a PHP script that should generate a list of all JPEG images in a specific directory. Which combination of PHP functions can achieve this?
- opendir(), readdir(), and substr()
- scandir(), file_get_contents(), and explode()
- glob() and file_get_contents()
- fopen() and fwrite()
To generate a list of JPEG images in a directory, you can use the opendir() and readdir() functions to iterate through files, and substr() to check file extensions. These functions are ideal for this task.
To move an uploaded file to a new location, PHP provides the ________ function.
- move_uploaded_file()
- rename()
- copy()
- unlink()
PHP provides the move_uploaded_file() function specifically for moving uploaded files to a new location, ensuring security and proper handling.
Superglobals in PHP are ________ arrays, meaning they can be accessed regardless of the scope.
- associative
- multidimensional
- indexed
- one-dimensional
Superglobals in PHP, like $_POST and $_GET, are associative arrays. They can be accessed globally and are pre-defined by PHP, making them accessible everywhere.
When using MySQLi in PHP, which function is used to prepare an SQL statement for execution?
- mysqli_query
- mysqli_prepare
- mysqli_execute
- mysqli_fetch
In MySQLi, the 'mysqli_prepare' function is used to prepare an SQL statement for execution. Prepared statements enhance security and performance.
What does PDO stand for in the context of PHP?
- PHP Data Object
- Public Data Object
- PHP Database Object
- PHP Data Operator
PDO stands for "PHP Data Object." It's a PHP extension that provides a consistent, database-agnostic interface for interacting with databases.