Podcast
Questions and Answers
Which function capitalizes the first character of a string?
Which function capitalizes the first character of a string?
What is the purpose of the substr()
function?
What is the purpose of the substr()
function?
Which function adds elements to the beginning of an array?
Which function adds elements to the beginning of an array?
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?
Signup and view all the answers
Which function sorts an array in descending order?
Which function sorts an array in descending order?
Signup and view all the answers
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?
Signup and view all the answers
What does the trim()
function do?
What does the trim()
function do?
Signup and view all the answers
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?
Signup and view all the answers
What does strtolower()
do?
What does strtolower()
do?
Signup and view all the answers
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?
Signup and view all the answers
Study Notes
String Functions
-
String manipulation:
-
strtolower()
: converts a string to lowercase -
strtoupper()
: converts a string to uppercase -
ucfirst()
: capitalizes the first character of a string -
lcfirst()
: converts the first character of a string to lowercase
-
-
String extraction:
-
substr()
: returns a portion of a string -
substr_replace()
: replaces a portion of a string
-
-
String searching:
-
strpos()
: finds the position of a substring within a string -
strrpos()
: finds the position of a substring within a string, starting from the end
-
-
String verification:
-
empty()
: checks if a string is empty -
isset()
: checks if a string is set
-
-
String formatting:
-
trim()
: removes whitespace from the beginning and end of a string -
ltrim()
: removes whitespace from the beginning of a string -
rtrim()
: removes whitespace from the end of a string
-
Array Functions
-
Array creation:
-
array()
: creates a new array -
range()
: creates an array of consecutive integers
-
-
Array manipulation:
-
array_push()
: adds one or more elements to the end of an array -
array_pop()
: removes the last element of an array -
array_shift()
: removes the first element of an array -
array_unshift()
: adds one or more elements to the beginning of an array
-
-
Array searching:
-
in_array()
: checks if a value exists in an array -
array_search()
: searches for a value in an array and returns its key
-
-
Array sorting:
-
sort()
: sorts an array in ascending order -
rsort()
: sorts an array in descending order -
asort()
: sorts an array in ascending order, maintaining key associations -
ksort()
: sorts an array by key in ascending order
-
-
Array filtering:
-
array_filter()
: filters elements of an array using a callback function -
array_diff()
: returns an array of elements that are not present in another array
-
String Functions
-
String manipulation:
-
strtolower()
converts a string to lowercase -
strtoupper()
converts a string to uppercase -
ucfirst()
capitalizes the first character of a string -
lcfirst()
converts the first character of a string to lowercase
-
-
String extraction:
-
substr()
returns a portion of a string -
substr_replace()
replaces a portion of a string
-
-
String searching:
-
strpos()
finds the position of a substring within a string -
strrpos()
finds the position of a substring within a string, starting from the end
-
-
String verification:
-
empty()
checks if a string is empty -
isset()
checks if a string is set
-
-
String formatting:
-
trim()
removes whitespace from the beginning and end of a string -
ltrim()
removes whitespace from the beginning of a string -
rtrim()
removes whitespace from the end of a string
-
Array Functions
-
Array creation:
-
array()
creates a new array -
range()
creates an array of consecutive integers
-
-
Array manipulation:
-
array_push()
adds one or more elements to the end of an array -
array_pop()
removes the last element of an array -
array_shift()
removes the first element of an array -
array_unshift()
adds one or more elements to the beginning of an array
-
-
Array searching:
-
in_array()
checks if a value exists in an array -
array_search()
searches for a value in an array and returns its key
-
-
Array sorting:
-
sort()
sorts an array in ascending order -
rsort()
sorts an array in descending order -
asort()
sorts an array in ascending order, maintaining key associations -
ksort()
sorts an array by key in ascending order
-
-
Array filtering:
-
array_filter()
filters elements of an array using a callback function -
array_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.
Description
Test your knowledge of string manipulation and extraction functions in PHP, including strtolower, strtoupper, ucfirst, and more.