PHP Functions Reference

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

PHP Built-in Functions by Category

PHP ships with thousands of built-in functions grouped into extensions. This list covers the functions developers look up most often, organised by category. Every page explains the syntax, parameters and return value, shows several examples with their real output, lists common mistakes, and includes an editor so you can run the code in your browser.

String Functions

Measure, search, cut, replace, split, join and format strings.

Array Functions

Transform, filter, reduce, merge, search and de-duplicate arrays.

JSON Functions

Encode PHP values to JSON and decode JSON strings.

Regular Expression Functions

Pattern matching and replacement with Perl-compatible regular expressions (PCRE).

Output and Debugging

Inspect variables while you develop.

  • print_r() - Print arrays and objects in readable form

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.