Defining Functions

PHP functions are defined by a prototype that includes a function name, a list of parameters, and a return data type. The basic prototype of a PHP function that takes no parameters and returns no values is

void function function_name();

Function names in PHP must start with an alphabetical character or an underscore and consist of only alphabetical characters, numbers, or underscores. Also, function names are global in scope and case insensitive, which means functions can only exist once in a page and its set of included PHP libraries.

The nature of global-scope functions differs from the convention in other popular programming languages. Whether a function is defined in a page, inside another function, or in its included ...

Get Oracle Database 10g Express Edition PHP Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.