9.4. Embedded Languages Versus PHP Functions

Many people are looking for the ultimate answer whether it is better to compute certain results on the application level or to implement additional functions in the database. The discussion is as old as the problem itself.

This section is not designed to present our ultimate view of the problem, but we will try to present an objective overview of the arguments presented by both sides.

Especially when huge amounts of data have to be processed, it might be useful to add functions to the database and not to write a PHP function, but respectively a PHP class. The reason for that is simple. Imagine a function used for computing the average of a list of columns. In the case of only a few records, you won't ...

Get PHP and PostgreSQL: Advanced 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.