Hacker News new | ask | show | jobs
by saranagati 5558 days ago
actually easier to maintain and faster in performance. For example, instead of doing require_once() doing a

if ( ! defined('SOMEINCLUDE')) require('file.php');

then defining SOMEINCLUDE in file.php.

Only saves 3% if i remember correctly but when you're including a hundred includes it adds up and when your site is spread across 30+ load balanced web servers every bit counts. As far as it being easier to maintain, it's easier to debug this way if something goes wrong.

However for things where you've gotta build some huge function (or any function really that's more than a line or 2) to replace a built in for such a small gain in performance I would agree with you.

1 comments

PHP leads to premature optimization. The root of the root of all evil.