php8.5
Home/ Manual/ appendices/ About the manual

About the manual

The PHP manual is provided in several formats. These formats can be divided into two groups: online readable formats, and downloadable packages.

Formats

The PHP manual is provided in several formats. These formats can be divided into two groups: online readable formats, and downloadable packages.

Note

Some publishers have made available printed versions of this manual. We cannot recommend any of those, as they tend to become out-of-date very quickly.

The manual can be read online at the PHP.net website. The online version of the PHP manual has currently two CSS stylesheets, web friendly and a printer-friendly stylesheet.

Two notable advantages of the online manual over most of the offline formats is the integration of user-contributed notes and the URL shortcuts that may be used to get to the desired manual parts quickly. An obvious disadvantage is the requirement to be online to view this edition of the manual.

There are several offline formats of the manual, and the most appropriate format for depends on the operating system, and personal reading style. For information on how the manual is generated in so many formats, read the 'How we generate the formats' section of this appendix.

The most cross-platform format of the manual is the HTML version. This is provided both as a single HTML file and as a package of individual files for each section (which results in a collection of several thousand files). We provide these versions compressed, so a decompression utility is required to retrieve the files contained within the archives.

For Windows platforms, the Windows HTML Help version of the manual enhances the HTML format for use with the Windows HTML Help application. This version provides full-text search, a full index, and bookmarking. Many popular Windows PHP development environments also integrate with this version of the documentation to provide easy access. CHM viewers for Linux desktops are also available. Check out xCHM or GnoCHM.

There is also an extended CHM version available, which is updated less frequently, but provides many additional features. It will only work on Microsoft Windows though, because of the technologies used to build the help pages.

About user notes

The user-contributed notes play an important role in the development of this manual. By allowing readers of the manual to contribute examples, caveats, and further clarifications from their browser, we are able to incorporate that feedback into the main text of the manual. And until the notes have been incorporated, they may be viewed in their submitted form online, and in some of the offline formats.

Note

The user-contributed notes are not moderated before they appear online, so the quality of the writing or code examples, and even the veracity of the contribution, cannot be guaranteed. (Not that there is any guarantee of the quality or accuracy of the manual text itself.)

Note

For the purposes of license coverage the user-contributed notes are considered part of the PHP manual, and are therefore covered by the same license that covers this documentation (Creative Commons Attribution at the moment). For more details see the Manual's Copyright page.

How to read a function definition (prototype)

Each function in the manual is documented for quick reference. Knowing how to read and understand the text will make learning PHP much easier. Rather than relying on examples or cut/paste, everyone should know how to read function definitions (prototypes). Let's begin:

Note

Although PHP is a loosely typed language, it's important to have a basic understanding of types as they have important meaning.

Function definitions tell us what type of value is returned. Let's use the definition for strlen() as our first example:

output
strlen

(PHP 4, PHP 5, PHP 7)
strlen -- Get string length

Description
strlen ( string $string ) : int

Returns the length of given string.
PartDescription
strlenThe function name.
(PHP 4, PHP 5, PHP 7)strlen() has been around in all versions of PHP 4, 5 and 7
( string $string )The first (and in this case the only) parameter/argument for this function is named string, and it's a string.
intType of value this function returns, which is an int (i.e. the length of a string is measured in numbers).

We could rewrite the above function definition in a generic way:

output
      function name    ( parameter type   parameter name ) : returned type

Many functions take on multiple parameters, such as in_array(). Its prototype is as follows:

output
      in_array ( mixed $needle, array $haystack , bool $strict = false ) : bool

What does this mean? in_array() returns a boolean value, true on success (if the needle was found in the haystack)Falseforfailure (if the needle was not found in the haystack). The first parameter is named needle and it can be of many different types, so we call it "mixed". This mixed needle (what we're looking for) can be either a scalar value (string, integer, or float), or an array. haystack (the array we're searching in) is the second parameter. The third optional parameter is named strict. All optional parameters have default values; if the default value is unknown, it is shown as ?. The manual states that the strict parameter defaults to boolean false. See the manual page on each function for details on how they work.

In addition the & (ampersand) symbol prepended to a function parameter allows the parameter to be passed by reference, as seen below:

output
       preg_match ( string $pattern , string $subject , array &$matches = null,
       int $flags = 0 , int $offset = 0 ) : int|false

In this example, we can see the third optional parameter &$matches will be passed as reference.

There are also functions with more complex PHP version information. Take html_entity_decode() as an example:

output
(PHP 4 >= 4.3.0, PHP 5, PHP 7)

This means that this function has only been available in a released version since PHP 4.3.0.

PHP versions documented in this manual

The manual contains information about past, current, and future versions of PHP. Changes in behaviour are documented as notes, changelogs, and inline text within the manual pages. The earliest documented version is PHP 7.0.0.

When documentation exists for the latest (unreleased) developmental versions of PHP, it will be labeled as either "available in Git" or "development version." And while these changes should be planned for, in rare cases they may change.

All development takes place in Git and may be checked out as described within the anonymous Git access page.

And to clarify, the manual will refer to major, minor and point PHP releases. Using PHP 7.3.1 as an example, the 7 refers to the major version, 3 to minor, and 1 is the point release. Typically PHP only adds new features to major and minor releases, and fixes bugs in point releases. However, this convention is not always true.

Also note that the PHP manual is written in present tense, not future tense, even for documented features that are not yet available. The reason for this is so the manual can stand the test of time, thus not require tedious grammar updates with every PHP release.

Many times the PHP manual lists "Default Values" for PHP directives. These values are based on how PHP behaves without a Ini configuration file, so this may differ from values found in the distributed php.ini-development and php.ini-production files. They also refer to the latest version of PHP, although changelog entries do mention past values. See the PHP directive appendix for details regarding these values and changes.

How to find more information about PHP

This manual does not attempt to provide instruction about general programming practices. First-time - or even just beginning - programmers may find it difficult to learn how to program in PHP using this manual exclusively. Instead, seek out a text more oriented towards beginners.

There are a number of active mailing lists for discussion on all aspects of programming with PHP. If stuck with a problem, consider using these lists. For support options, including mailing lists, view the PHP.net support page.

How to help improve the documentation

There are several ways everyone can help improve this documentation.

If an error is found in this manual, in any language, please report them using the issue tracker of the respective language repository at Git; for instance, errors in the English manual should be reported at Gitdoc-en/issues. All documentation related problems, including those about manual formats, should be submitted as bug reports.

Note

Please don't abuse the issue trackers by submitting requests for help. Instead, use one of the many support options.

By contributing notes, users may provide additional examples, caveats, and clarifications for other readers. But please do not submit bug reports using the annotation system. For details, see the section titled 'About user notes'.

It is also possible to submit pull requests to the Github mirror of the documentation repository.

The PHP manual is translated into many languages. Knowing English and a foreign language allows for another way to help improve the PHP manual by working with a translation team. For information about starting a new translation, or helping a currently translated version, please read Dochowto.

The PHP Documentation Project also has an IRC channel where many manual authors hang out. Stop by #php.doc on irc.efnet.org and discuss ways to improve the PHP documentation.

How we generate the formats

This manual is written in XML using the DocBook XML DTD, using PhD (The [PH]P based [D]ocBook renderer) for maintenance and formatting.

Using XML as a source format gives the ability to generate many output formats from the source files, while only maintaining one source document for all formats. The tool used for formatting the online manual is PhD. We use Microsoft HTML Help Workshop to generate the Windows HTML Help format of the manual, and of course PHP itself to do some additional conversions and formatting.

The PHP manual is generated in various languages and formats, see Docs for additional details. The XML source code may be downloaded from git and viewed at Mirrordoc-en.

Translations

The PHP manual is available not only in various formats, but also in various languages. The text of the manual is first written in English, then teams of people across the world take care of translating it to their native languages. If a translation for a specified function or chapter has not yet been made, the manual's build system falls back to the English version of it.

People involved in the translations start from the XML source code available from Mirrordoc-en and from it they translate to their mother language. They do not use the generated versions (like HTML or plain text) as it's the build system that takes care of the conversions from XML to human readable formats.

Note

To help translate the documentation, please get in touch with the translation/documentation team by subscribing to the phpdoc mailing list: send an empty mail to Subscribe. The mailing list address is Doc. State in the message an interest in translating the manual and someone will reply with feedback on moving forward by helping start a new language translation, or by contacting the existing team for the desired language.

At the moment the manual is available, partly or not, in over 10 languages.

They may all be downloaded here: Docs.

Source: appendices/about.xml · from the official PHP manual (php/doc-en)