Lecture_5-PHP Functions.pdf
Document Details
Uploaded by ReverentLobster
Full Transcript
PHP FUNCTIONS (STRING, ARRAY, MATH, DATE/TIME, MISCELLANEOUS) PHP String Functions substr() Function The substr() function returns a part of a string. Syntax: substr(string,start,length); strtoupper() Function The strtoupper() function converts a string to u...
PHP FUNCTIONS (STRING, ARRAY, MATH, DATE/TIME, MISCELLANEOUS) PHP String Functions substr() Function The substr() function returns a part of a string. Syntax: substr(string,start,length); strtoupper() Function The strtoupper() function converts a string to uppercase. Syntax: strtoupper(string) ; strtolower() function converts a string to lowercase. PHP String Functions strlen() Function The strlen() function returns the length of a string. Syntax: strlen(string) ; trim() Function The trim() function removes whitespace and other predefined characters from both sides of a string. Syntax:trim(string,charlist) ; ltrim() - Removes whitespace or other predefined characters from the left side of a string. rtrim() - Removes whitespace or other predefined characters from the right side of a string. PHP String Functions strrev() Function The strrev() function reverses a string. Syntax: strrev(string) ; explode() Function The explode() function breaks a string into an array. Syntax: explode(separator,string) ;