Podcast
Questions and Answers
Which function capitalizes the first character of a string?
Which function capitalizes the first character of a string?
- lcfirst()
- strtoupper()
- ucfirst() (correct)
- strtolower()
What is the purpose of the substr()
function?
What is the purpose of the substr()
function?
- To convert a string to uppercase
- To return a portion of a string (correct)
- To capitalize the first character of a string
- To replace a portion of a string
Which function adds elements to the beginning of an array?
Which function adds elements to the beginning of an array?
- array_unshift() (correct)
- array_pop()
- array_shift()
- array_push()
If you need to check if a string is set, which function would you use?
If you need to check if a string is set, which function would you use?
Which function sorts an array in descending order?
Which function sorts an array in descending order?
Which function would you use to remove the last element of an array?
Which function would you use to remove the last element of an array?
What does the trim()
function do?
What does the trim()
function do?
Which function searches for a value in an array and returns its key?
Which function searches for a value in an array and returns its key?
What does strtolower()
do?
What does strtolower()
do?
Which of these functions will remove whitespace only from the beginning of a string?
Which of these functions will remove whitespace only from the beginning of a string?
Flashcards are hidden until you start studying
Study Notes
String Functions
- String manipulation:
strtolower()
: converts a string to lowercasestrtoupper()
: converts a string to uppercaseucfirst()
: capitalizes the first character of a stringlcfirst()
: converts the first character of a string to lowercase
- String extraction:
substr()
: returns a portion of a stringsubstr_replace()
: replaces a portion of a string
- String searching:
strpos()
: finds the position of a substring within a stringstrrpos()
: finds the position of a substring within a string, starting from the end
- String verification:
empty()
: checks if a string is emptyisset()
: checks if a string is set
- String formatting:
trim()
: removes whitespace from the beginning and end of a stringltrim()
: removes whitespace from the beginning of a stringrtrim()
: removes whitespace from the end of a string
Array Functions
- Array creation:
array()
: creates a new arrayrange()
: creates an array of consecutive integers
- Array manipulation:
array_push()
: adds one or more elements to the end of an arrayarray_pop()
: removes the last element of an arrayarray_shift()
: removes the first element of an arrayarray_unshift()
: adds one or more elements to the beginning of an array
- Array searching:
in_array()
: checks if a value exists in an arrayarray_search()
: searches for a value in an array and returns its key
- Array sorting:
sort()
: sorts an array in ascending orderrsort()
: sorts an array in descending orderasort()
: sorts an array in ascending order, maintaining key associationsksort()
: sorts an array by key in ascending order
- Array filtering:
array_filter()
: filters elements of an array using a callback functionarray_diff()
: returns an array of elements that are not present in another array
String Functions
- String manipulation:
strtolower()
converts a string to lowercasestrtoupper()
converts a string to uppercaseucfirst()
capitalizes the first character of a stringlcfirst()
converts the first character of a string to lowercase
- String extraction:
substr()
returns a portion of a stringsubstr_replace()
replaces a portion of a string
- String searching:
strpos()
finds the position of a substring within a stringstrrpos()
finds the position of a substring within a string, starting from the end
- String verification:
empty()
checks if a string is emptyisset()
checks if a string is set
- String formatting:
trim()
removes whitespace from the beginning and end of a stringltrim()
removes whitespace from the beginning of a stringrtrim()
removes whitespace from the end of a string
Array Functions
- Array creation:
array()
creates a new arrayrange()
creates an array of consecutive integers
- Array manipulation:
array_push()
adds one or more elements to the end of an arrayarray_pop()
removes the last element of an arrayarray_shift()
removes the first element of an arrayarray_unshift()
adds one or more elements to the beginning of an array
- Array searching:
in_array()
checks if a value exists in an arrayarray_search()
searches for a value in an array and returns its key
- Array sorting:
sort()
sorts an array in ascending orderrsort()
sorts an array in descending orderasort()
sorts an array in ascending order, maintaining key associationsksort()
sorts an array by key in ascending order
- Array filtering:
array_filter()
filters elements of an array using a callback functionarray_diff()
returns an array of elements that are not present in another array
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.