PHP Programming with MySQL: chapter 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the escape sequence for a single quotation mark?

The backslash followed by an apostrophe (\')

What is the difference between the strcasecmp() function and the strcmp() function?

The difference between the two is that the strcasecmp() function performs a case-insensitive comparison of strings, whereas the strcmp() function performs a case-sensitive comparison.

Describe the purpose of quantifiers in determining if a string matches a pattern.

They are Metacharacters that specify the quantity of a match.

If you include an array within a text string, you need to use complex string syntax. True or False?

True

Which of the following character sets do you use for complex string syntax?

curly braces ({}), are placed within curly braces inside a string, is called complex string syntax.

Which of the following functions splits each character in a string into an array element?

explode(), str_split()

If you specify an empty string as the second argument of the strtok() function, or if the string does not contain any of the separators you specify, the strtok() function returns a value of FALSE. True or False?

false

A \. is used to match any single character in a pattern. True or False?

false .

Which of the following quantifiers can be used to specify the quantity of a match in a regular expression?

question mark (?) asterisk (*) plus sign (+)

Describe the purpose of the | metacharacter.

same as using the Or operator (||) to perform multiple evaluations in a conditional expression.

What functions are used to split a string into an indexed array?

str_split() or explode() function to split a string into an indexed array.

What string function would you use to determine if an essay keyed in a <textarea> form input field exceeds the maximum number of words allowed?

str_worrd_count()

What string function would you use to determine the number of characters in a password that a user has entered?

strlen()

Which of the following functions returns the length of a string?

strlen()

What function can be used to determine if a specific character exists in a string?

strpos(string, substring)

What two string functions could be used to convert the case of text strings to all uppercase or all lowercase letters?

strtoupper(), strtolower()

Which of the following functions performs a case-sensitive search for specified characters in a string and returns a sub- string from the last occurrence of the specified characters to the end of the string?

substr()

Which of the following functions allows you to replace characters within a specified portion of a string?

substr_replace()

String comparison operators and most string comparison functions compare individual characters according to their ASCII value. True or False?

true

Describe the use of curly braces in complex string syntax.

variables are placed within curly braces inside a string, is called complex string syntax.

Explain how to determine whether the strpos() function (and other string functions) actually returns a Boolean value of FALSE and not a 0 representing the first character in a string.

you must use the strict not equal operator (!==)

How do you specify that you want to ensure that a string contains an actual period and not just any character?

you need to escape the period with a backslash.

Describe two ways to display double quotation marks within a literal string.e.

" ", ' ',

Explain the difference between a concatenation operator and a concatenation assignment operator.

(.=).combines two text strings, but without using the $City or $Country variables. the concatenation operator (.) combines several string variables and literal strings, and assigns the new value to another variable:

Which of the following operators can be used with strings?

. .=

How are subexpressions or subpatterns used in a regular expression?

Characters contained in a set of parentheses within a regular expression are referred to as a subexpression or subpattern. Subexpressions allow you to determine the format and quantities of the enclosed characters as a group.

Explain why you need to use complex string syntax. Be sure to include an example.

Complex string syntax is only recognized if the opening brace is immediately before or after a variable's dollar sign. $Vegetable = "carrot"; echo "<p>Do you have any {$Vegetable}s?</p>";

Explain the difference between the similar_text() function and the levenshtein() function.

The similar_text() function returns the number of characters that two strings have in common, whereas the levenshtein() function returns the number of characters you need to change for two strings to be the same.

Explain how to use the strtok() function to break a string into tokens and then navigate through each token.

The strtok() function is $variable = strtok(string, separators); .

What character is used to match any single character in a pattern?

You use a period (.) to match any single character in a pattern.

Which of the following character pairs match characters at the beginning and end of a string in a regular expression?

^ and $

Explain the difference between the two types of extraction functions.

functions that return a numeric position in a text string, and functions that return a character or substring.

Which of the following functions returns the number of char- acters you need to change for two strings to be the same?

levenshtein()

Why is the lowercase "a" considered to occur later in the alphabet than the uppercase "A"?

lowercase letters have higher ASCII values than uppercase letters, the lowercase letters are evaluated as being "greater" than the uppercase letters.


Set pelajaran terkait

Topic D3-Install and Configure RAID

View Set

HNF 150 FOOD INSECURITY + HUNGER & SUSTAINABLE FOOD SYSTEMS

View Set

Exam 3 study guide Strength and Conditioning

View Set