Strings Flashcards
What is the difference between ‘’ y “” ?
Que en “” puedo poner la variable directo sin concatenar:
“mi nombre es $nombre”
How do you get the length of a string?
strlen($string)
How do you trim a string?
trim($string)
How do you trim the left side of a string?
ltrim($string)
How do you trim the right side of a string?
rtrim($string)
How do you count the number of words of a string?
str_word_count($string)
How do you reverse a string?
strrev($string)
How do you make the entire string into uppercase?
strtoupper($string)
How do you make the entire string into lowercase?
strtolower($string)
How do you make the first character uppercase?
ucfirst($string)
How do you make the first character lowercase?
lcfirst($string)
How do you capitalize the first char of every word?
ucwords($string)
How do you find the index of a word?
strpos($string,’word’)
How do you find the index of a word no without taking into account capitalization?
stripos($string,’word’)
How do I get a substring from a certain index?
substr($string,index)