Understanding Sessions
Which PHP function is used to begin a new session or resume an existing one for maintaining user login information across multiple web pages?
- session_start()
- start_session()
- beginSession()
- init_session()
- session_begin()
Constants vs. Variables
In PHP, which statement correctly explains the difference between variables and constants when defining values?
- Variables can be changed after definition, while constants cannot be changed
- Constants can be changed after definition, while variables cannot
- Both variables and constants cannot be changed after definition
- Variables start with @, constants start with $
- Variables must be declared using define(), constants with the $ sign
PEAR Meaning
What does 'PEAR' stand for in the context of PHP libraries?
- PHP Extension and Application Repository
- PHP Easy Application Resource
- Personal Encryption Application Reader
- Processing Engine And Runtime
- PHP Enhanced Algorithm Reference
Variable Variables
If $message = 'hello' and $$message = 'world', what is the value of $$message in PHP?
- 'world'
- 'hello'
- $message
- '$world'
- 'message'
Case Sensitivity
Is PHP considered a case-sensitive programming language in all situations?
- No, variable names are case-sensitive but function names are not
- Yes, everything is case-sensitive
- No, keywords are case-sensitive but variables are not
- Yes, except for constants
- No, PHP is not case-sensitive at all
Array Types
Which of the following is NOT a valid type of array in PHP?
- Circle array
- Indexed array
- Associative array
- Multidimensional array
- All of the above are valid
Cookie Creation
Which function is used in PHP to send a cookie to the user's browser?
- setcookie()
- send_cookie()
- cookie_set()
- makecookie()
- create_cookie()
Hashing Passwords
What is the most commonly recommended PHP function for safely hashing passwords?
- password_hash()
- crypt_password()
- hashpass()
- md5()
- sha1()
Require vs. Include
Between require() and include(), what is the main difference during script execution?
- require() causes a fatal error if the file is missing; include() only throws a warning
- include() causes a fatal error, require() only throws a warning
- Both stop the script immediately if the file is missing
- Both only show a notice if the file is missing
- require() and include() are identical in every way
Error Control Operator
What is the function of the '@' operator when placed before a PHP expression?
- It suppresses error messages that would otherwise be generated by the expression
- It concatenates two strings
- It executes the expression asynchronously
- It acts as a comment delimiter
- It makes the variable a constant