PHP – How to read the PHP documentation

How to use a function

A function is, generally, a single word with capitalisation to show where two words were put together. e.g:

Some functions accept “arguments” inside the brackets which will alter the output, transform your input, etc. E.g:

Each function behaves differently and so you should look it up on the PHP manual page

PHP Manual Pages Explained

This is the full function description for the “date” function at the top of the page:

Let’s disect this and see what each part means.

The “string” part dictates the type of the value that is output and the “date” part is the name of the function we’re looking at. This says the output will be printed like a string.

The “string” part of this segment tells us what type of input it can take. This says that it takes a string.

The “$format” part says that string must be in the form of the format specified lower down the page. (note: the variable named here is the name of the section relevant to it – so $format has a format section on the manual page)

If there are multiple arguments in a function, they must be separated by a comma.

Anything in square brackets is an optional argument.

“int” refers to the type of the input that is acceptable.

“$timestamp” is the same as above and refers to a section further down the manual page.

“$timestamp = time()” says that the default value (if $timestamp is left out) is whatever the output of the “time” function is.