4381 A4

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which character is used to signify the end of the string in a PHP regular expression?

$

This pattern can be used to validate a five-digit zip code:

/^\d{5}$/

Because most systems today store timestamps as 32-bit signed integers, the upper limit of a timestamp on these systems is January 19 in the year ______________________.

2038

Why is it important not to begin an integer value with a zero (e.g., 03), when working with numbers in calculations?

Because it would be treated as an octal value, and yield an incorrect result.

The diff method of a DateTime object requires another DateTime object as its argument and returns a ______________________________ object.

DateInterval

One of the methods of a ______________________________ object lets you add a DateInterval object to the object.

DateTime

The use of _________________________ objects resolves the Y2K38 problem because the upper limits of dates and times are essentially removed.

DateTime

If a number in a PHP application is larger than the maximum value that PHP provides for, it is converted into the PHP constant named _________________________.

INF

With the use of the following escape sequences, what is stored in $message by the code that follows? $message = "The file is in \"C:\\My Documents\"";

The file is in "C:\My Documents"

Which character is used to signify the beginning or the end of a word in a PHP regular expression?

\B

Which of the following will match any character that is NOT a letter, number, or underscore in a PHP regular expression?

\W

Which of the following will match any digit in a PHP regular expression?

\d

Which of the following will match any letter, number, or underscore in a PHP regular expression?

\w

Which character is used to signify the beginning of the string in a PHP regular expression?

^

$current_date = new DateTime(); $due_days_diff = $current_date->diff($due_date); if ($current_date > $due_date) { $overdue_message = $due_days_diff->format( '%y years, %m months, and %d days overdue.'); } If $due_date contains a DateTime object, $due_date_diff will contain

a DateInterval object

Regular expressions

can be used to completely validate all types of user entries

The strcasecmp function is _________________________. As a result, "Anders" comes before "zylka".

case-insensitive

If you want to code a catch block that catches all types of exceptions and gets the message associated with the exception, you start the catch block like this:

catch (PDOException $e) {

Type casting refers to PHP code that converts a value from one _________________ to another.

data type

The explode function returns an array of strings from a single string based on the _________________________ character that you specify.

delimiter

In order to print out a variable's value, when you code a variable name within a string literal, you have to enclose the literal within __________________________ quotation marks.

double

By using ____________________, you can put special characters into a string literal that would otherwise be interpreted incorrectly by PHP.

escape sequences

Runtime errors that occur due to unexpected error conditions are called ________________.

exceptions

To get the message that's related to an exception, you use the

getMessage method of the exception object

By using the ____________________ function, you can send special characters to the browser in a way that they will be displayed correctly.

htmlentities

What modifier can be added to the end of a regular expression in PHP to make it case insensitive?

i

In an if statement, which is a correct right way to find out whether the string in $a comes before (is less than) the string in $b in a case-insensitive comparison?

if ((strtolower($a) < (strtolower($b))

A substring within a string is identified by its ______________________ and its ______________________ within the string.

length, starting position

The ____________________ function returns the largest value of the two or more arguments that are passed to it.

max()

To create a DateTime object for the current date, you use the _________________ and pass no arguments to the constructor.

new keyword

A DateInterval object represents a/an _________________ time.

period of

Which function searches for a regular expression in a string and returns 1 if the pattern is found?

preg_search

Which of the following are coded patterns that you can use to search for matching patterns in text strings?

regular expressions

The ltrim and rtrim functions let you ______________________ from the front or back of a string.

remove all spaces

The date function makes it easy to create a timestamp for the current date and then _______________________ before returning the value.

return a string formatted as a date

If you want to round a number within an arithmetic expression, which function should you use?

round

A timestamp stores the number of ____________________ since midnight on January 1, 1970 GMT.

seconds

After you create a DateTime object, you can use its setTime method to change the time or its _________________ method to change the date.

setDate

A list of functions or methods in the reverse order in which they were called is a(n)________________.

stack trace

Which of the following functions returns the length of a string (i.e., number of characters that it contains)?

strlen()

When you use the substr function to extract a substring from a string, you need to at least pass an argument that gives

the starting position of the substring

Using strnatcasecmp($str1, $str2) function for a "natural" comparison of two values

would evaluate both "09" and "9" as being before "10"

When you create a DateInterval object, you can use the format() method, and pass it a number of arguments that specifies a format code for one or more of the following descriptions:

years, months, days, hours, minutes, seconds, and sign (+ or -) of the date interval


Ensembles d'études connexes

Correlation and Linear Regression

View Set

Traditions and Encounters Chapter 23

View Set

Module2 Ideas and Execution of small business

View Set

Exam 3 PathoBio UU online course

View Set

Human Behavior Exam #2 Quiz Questions

View Set

History Alive! Section 8.3: "Pharaoh Khufu: The Pyramid Builder"

View Set

Supply Chain Management, Ch. 1-4, Exam 1

View Set