PHP Functions Reference

Complete guide to PHP built-in functions with examples, parameters, return values, and common pitfalls

PHP Built-in Functions by Category

Browse our comprehensive reference of PHP built-in functions organized by category. Each function page includes detailed documentation, usage examples, parameter descriptions, return values, and common gotchas to help you use PHP functions effectively.

String Functions

Functions for manipulating and processing strings including length, search, replace, and transformation operations.

  • strlen() - Get string length
  • substr() - Return part of a string
  • strpos() - Find position of first occurrence of substring
  • str_replace() - Replace all occurrences of search string
  • explode() - Split string by delimiter
  • implode() - Join array elements with string
  • trim() - Strip whitespace from beginning and end

Array Functions

Functions for array manipulation, transformation, filtering, and processing operations.

JSON Functions

Functions for encoding and decoding JSON data in PHP applications.

Regular Expression Functions

Pattern matching and text processing using Perl-compatible regular expressions.

How to Use This Reference

Each function reference page includes:

  • Function Signature: Complete syntax showing parameters and types
  • Description: What the function does and when to use it
  • Parameters: Detailed explanation of each parameter
  • Return Values: What the function returns and possible return types
  • Examples: Practical code examples demonstrating usage
  • Notes & Gotchas: Common pitfalls, edge cases, and best practices

Test Functions Online

All function examples can be tested using our online PHP compiler. Click any function to view its documentation and run example code directly in your browser. Modify the examples to experiment with different parameters and see how the function behaves with different inputs.