All articles

Understand PHP execution and behavior

Find PHP Built-In Functions in the Manual and Your Runtime

Find documented PHP functions, list the built-in functions defined in your runtime, and inspect loaded extensions when a function is missing.

Editorial illustration for Find PHP Built-In Functions in the Manual and Your Runtime

To find a PHP built-in function, start with the manual. To find out whether it is defined in the PHP runtime you are using, run get_defined_functions() there and inspect its internal entry. Those answer different questions: the manual helps you discover and understand functions, while the runtime check tells you which internal function names are defined in that environment. If a documented name is missing, checking loaded extensions is a useful next step.

Browse names, then browse related functions

The PHP manual has a function and method index for looking up a name. It includes methods as well as functions, so do not treat every entry as a standalone built-in function. For example, the index contains both abs and AppendIterator::append. It is a documentation catalog, not a promise that every listed name is defined in your runtime.

When you want to see related functions, move from the alphabetical index to a reference page. The manual is organized by extension, and its Array Functions reference lists array_filter with a short description: it filters elements of an array using a callback function. This gives you a practical route from a topic to a candidate name without turning this article into a tour of array operations.

Open the function page before relying on its name

Once you have a candidate such as array_filter, open its individual manual page from the reference. The manual's guide to internal functions says individual pages provide parameters, return values for success and failure, behavior changes, and availability information. A name in a list does not tell you what arguments a call needs or whether its documented behavior applies in the environment you are investigating.

Use that page to answer the question behind the lookup. If you are deciding how to call a function, read its parameters and return values. If you are investigating a difference in behavior or a missing function, pay particular attention to behavior changes and availability. Then make a separate runtime check rather than treating the documentation index as an inventory of your installation.

Print the internal functions in your runtime

Run this complete PHP file in the PHP runtime you want to inspect. It assigns the result of get_defined_functions() to a variable, then prints only the names under internal:

<?php
$functions = get_defined_functions();

foreach ($functions['internal'] as $name) {
    echo $name, "\n";
}

The documentation for get_defined_functions() distinguishes built-in, or internal, functions from user-defined functions. Its result has an internal entry for the former and a user entry for the latter. Selecting internal matters here: printing both entries would answer a different question by mixing functions defined in the runtime with functions defined by application code.

For a concrete check, find array_filter in the Array Functions reference, open its function page for the details, then look for array_filter among the names printed by this file. The manual lookup explains the function; the printed list answers whether its name appears among the internal functions in the runtime where you ran the file. If you need to inspect a different runtime, run the check there rather than carrying over the first list.

Check extensions when a documented name is absent

Some functions require a specific PHP extension; without it, an undefined-function error can occur. Run this as a separate PHP file in the same runtime you are investigating to display its loaded extensions:

<?php
foreach (get_loaded_extensions() as $extension) {
    echo $extension, "\n";
}

The manual identifies get_loaded_extensions() as a way to see which extensions are loaded into PHP. Compare that result with the availability information on the missing function's manual page. This check does not turn the documentation catalog into a runtime guarantee, but it helps you investigate a relevant cause of the missing name. Keep the two observations tied to the runtime in which you made them: a documented function, an internal-function list, and a loaded-extension list serve different purposes.

← All articles