PHP Functions and User-Defined Functions
PHP has a wide variety of built-in functions that can be used for many tasks. These include array functions, math functions, internationalization functions, and a whole host of other functions that are included with the PHP runtime. There are also user-defined functions that developers can create to perform specific tasks. All functions must be declared using the function keyword and should be contained within curly brackets
Functions are useful for doing simple repetitive tasks, such as looping through an array, performing calculations on each element in the array, or converting one type of data into another. They can be called from anywhere in a script and may take one or more arguments. A function can return a value or raise an error. The first argument is a variable, and subsequent arguments are called parameters. When calling a function, all parameter settings should be in the form of a keyword = value. If the keyword has spaces, they must be surrounded by single quotes (').
A PostgreSQL query result resource returned by pg_query() or pg_query_params(), or from the query command executed in psql. The row number of the query to fetch, or if omitted, the next query row. The field (column) in the query to fetch, or if a boolean value is returned, the result type.