🐘 PHP Beginner

What are PHP string functions?

Answer

PHP provides a rich library of built-in string functions. Commonly used ones: strlen($str) (length), strtolower($str) / strtoupper($str) (case conversion), trim($str) (strip whitespace from both ends), str_replace($find, $replace, $str) (find and replace), strpos($str, $needle) (find position of first occurrence — returns false if not found), substr($str, $start, $length) (extract substring), explode($delimiter, $str) (split string into array), implode($glue, $array) (join array into string), sprintf($format, $args) (format a string), str_pad(), str_repeat(), and htmlspecialchars() (escape HTML entities for security).