php prelim Flashcards
Which of the following represent a header for the mail() function?
“From: example@example.com”
“Subject: Important Message”
Which two commands convert HTML tags to plain text?
html_entity_decode()
strip_tags()
Which user-defined function sorts an array by keys?
ksort()
What is the result of the command intdiv(9, 2)?
4
theres never a reminder and it rounds down
What is the result ofthe following code: echo $today = date(“d/m/y”);?
“09/10/23”
What are two effects of the sizeof(array) command?
Returns the number of elements in the array.
Returns the amount of memory (in bytes) used by the array
What is the outcome of the given code snippet: $stack = array(“orange”, “banana”, “apple”,
“raspberry”); $fruit = array_pop($stack);?
$fruit = array_pop($stack); // $fruit contains “raspberry” and $stack is modified to [“orange”,
“banana”, “apple”]
What is the proper sequence of steps to create an IF condition?
Condition, True Block, Optional Else Block.
Which of the following are considered logically false values? (Choose 3)
false
null
0
What is the purpose of IntlChar?
IntlChar is a PHP extension that provides functions to work with Unicode characters andstrings
Which of the following represents a Null coalescing operator?
??
What is the proper sequences of steps to establish a FOR condition?
Initialization, Condition, Increment/Decrement
What is the outcome of the given code: $x = 0; do { echo “$x”; $x++; } while ($x != 10);?
The code will print numbers from 0 to 9
Which three events terminate a session?
Closing the browser
Calling session_destroy()
Timeout due to inactivity
Which PDO function safeguards against threats such as SQL injections?
PDO::prepare
Which query retrieves the city and average age of cities with an average age greater than 30 years?
SELECT city, AVG(age) AS avg_age FROM citiesWHERE avg_age > 30
Which of the following retrieves a value from a page indirectly?
$_SESSION
What are two outcomes ofthe PDOStatement::fetchObjectstatement?
Retrieves the specified column values as object properties.
Fetches the next row from a result set as an object
What are two effects of the session_destroy() function?
Ends the current session and closes the browser.
Deletes all data associated with the current session.
What is the result of the following code? $sth = $dbh->prepare(“SELECT name, color FROM “fruit”);
@colcount = $sth->columnCount();
The code will generate a syntax error