Shared Flashcard Set

Details

Zend Certification PHP 5.3
Flash cards that cover common array and string functions
21
Computer Science
Professional
11/19/2011

Additional Computer Science Flashcards

 


 

Cards

Term
string addslashes ( string $str )
Definition
Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
Term
string rtrim ( string $str [, string $charlist ] )
Definition
Returns a string with whitespace stripped from the end of str.
Term
string ltrim ( string $str [, string $charlist ] )
Definition
Strip whitespace (or other characters) from the beginning of a string.
Term
int strlen ( string $string )
Definition
Returns the length of the given string.
Term
array explode ( string $delimiter , string $string [, int $limit ] )
Definition
Returns an array of strings, each of which is a substring of arg $string formed by splitting it on boundaries formed by the string delimiter.
Term
join
Definition
alias of implode
Term
string implode ( string $glue , array $pieces )
Definition
Join array elements with a glue string. Returns a string containing a string representation of all the array elements in the same order, with the glue string between each element.
Term
preg_match(string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )
Definition
Searches subject for a match to the regular expression given in pattern. returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match. preg_match_all() on the contrary will continue until it reaches the end of subject. Will return FALSE if an error occurred.
Term
string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )
Definition
Returns part of haystack string from the first occurrence of needle to the end of haystack.
Term
int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )
Definition
Searches subject for all matches to the regular expression given in pattern and puts them in matches in the order specified by flags.

After the first match is found, the subsequent searches are continued on from end of the last match.
Term
array preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] )
Definition
Split the given string by a regular expression. Returns an array containing substrings of subject split along boundaries matched by pattern.
Term
mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
Definition
Searches subject for matches to pattern and replaces them with replacement. preg_replace() returns an array if the subject parameter is an array, or a string otherwise.

If matches are found, the new subject will be returned, otherwise subject will be returned unchanged or NULL if an error occurred.
Term
mixed array_pop ( array &$array )
Definition
array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Will additionally produce a Warning when called on a non-array.
Term
int array_push ( array &$array , mixed $var [, mixed $... ] )
Definition
array_push() treats array as a stack, and pushes the passed variables onto the end of array. The length of array increases by the number of variables pushed. Has the same effect as:
$array[] = $var;
?>
repeated for each var.

Returns the new number of elements in the array.
Term
mixed array_shift ( array &$array )
Definition
array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. Returns the shifted value, or NULL if array is empty or is not an array.
Term
string substr ( string $string , int $start [, int $length ] )
Definition
Returns the extracted part of string, or FALSE on failure or an empty string.
Term
strpos( string haystack, string needle, int start )
Definition
returns the position of the first occurrence or FALSE.
Term
strlen( string )
Definition
returns number of characters in the string, or 0 if its empty.
Term
mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )
Definition
Counts the number of words inside string. If the optional format is not specified, then the return value will be an integer representing the number of words found. In the event the format is specified, the return value will be an array, content of which is dependent on the format. The possible value for the format and the resultant outputs are listed below.

For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with "'" and "-" characters. Returns an array or an integer, depending on the format chosen.
Term
strcasecmp(str1, str2)
Definition
case-insensitive comparison. Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
Term
strcmp(str1, str2)
Definition
case-sensitive comparison. Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
Supporting users have an ad free experience!