PHP built-in functions

PHP built-in functions

February 26, 2024
php built in functions

PHP comes with a vast library of built-in functions that you can use for various purposes, ranging from string manipulation, array handling, file operations, session management, and much more. Here’s an overview of some of the categories of built-in functions in PHP, along with examples from each category:

Name Description
error_log Send an error message to the defined error handling routines

 

Category Function Description
String Functions
String strlen($string) Returns the length of a string.
str_replace($search, $replace, $subject) Replaces all occurrences of the search string with the replacement string.
strpos($haystack, $needle) Finds the position of the first occurrence of a substring in a string.
Array Functions
Array array_merge($array1, $array2) Merges one or more arrays.
count($array) Counts all elements in an array, or something in an object.
array_filter($array, $callback) Filters elements of an array using a callback function.
File System Functions
File System fopen($filename, $mode) Opens file or URL.
file_get_contents($filename) Reads entire file into a string.
file_put_contents($filename, $data) Write data to a file.

Leave A Comment