© Frank M. Kromann 2016

Frank M. Kromann, PHP and MySQL Recipes, 10.1007/978-1-4842-0605-8_11

11. Functions

Frank M. Kromann

(1)Trabuco Canyon, California, USA

Functions are a way to structure code that is used several times into a convenient structure. This is a great way to reduce code duplication and increase reusability. There are more than 1000 built-in functions in PHP and user-defined functions can be declared in the main script or in an include file, and it is up to the script developer to make sure the correct files are included before a function is called.

Recipe 11-1. Calling Functions

Problem

In chapter 2 we discussed the use of classes to build objects of data (member variables) and functionality (methods). Using a class to instantiate ...

Get PHP and MySQL Recipes: A Problem-Solution Approach, Second Edition 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.