Chart of execution time between dirname(__FILE__) and __DIR__ in PHP, showing 4 to 10 times efficiency improvement using __DIR__
dirname(__FILE__) vs __DIR__, which is faster?

If you’re developing PHP software today but studied PHP based on old-ish manuals or manuals written by people who did, you might find a mix of calls to dirname(__FILE__) and __DIR__ and wonder what the difference is… Past the fact…

More Details
Benchmark: dirname(__FILE__) vs __DIR__ in PHP

dirname(__FILE__) and __DIR__ give exactly the same result in PHP, although one (__DIR__) is evaluated at compile-time, while the other (dirname(__FILE__)) has at least part of it (the function) evaluated at execution time. Ever wondered what the difference is, in…

More Details
Can’t use function return value in write context

Did you ever develop some nice code, then simply wanted to check if a string was only composed of white spaces or tabs, and used something like this: if (!empty(trim($string))) { … } …only to get a bad error appear…

More Details
Using php5-memcached to store sessions on distributed servers

This article is an extension of the previous article about storing sessions in Memcached with PHP. Using Memcached for sessions storage is generally a matter of speed (storing them in memory is faster than on disk) and of scalability (using…

More Details
Howto: Configuring session expiry time in Chamilo

Note: this article was originally written for Chamilo 1.9 but it is also valid for all versions 1.10 and 1.11. We seldom receive a request from users of Chamilo LMS saying their sessions are cut in the middle of their…

More Details
Creating new tasks in chamilo course-sessions

In the category of little scripts that can make your life easier when managing huge Chamilo portals, this is a little one that creates one tasks-folder called “ALP” for the “Assignments” (work) tool in each active course for a portal…

More Details
On PHP and cache slams and solutions

While reading about Doctrine’s cache mechanism (which applies to other stuff than database queries, by the way), my eye was caught by a little message at the end (last section) about cache slams. I have used cache mechanisms extensively over…

More Details
PHP’s @ hurts performance

Did you know…? As a “take away” information taken from this post https://gist.github.com/nikic/6699370 (by famous PHP core developer @nikita_ppv), it appears like the @ sign in PHP (used to “hide” errors, as the “error-suppression operator” it is) also disables the…

More Details
Gallery 2.3 not translating

Just in case you would fall upon this issue as well, Gallery2 requires the corresponding language-specific locales to be installed on the system (it depends on them to show the matching translated terms). The code to do that (and to…

More Details
PHP’s call_user_func_array() is slow

I just solved an issue that had me waking up in the middle of the night for weeks (just pushing it a bit) and I have to thank PHP’s community and in particular a guy named Brad Proctor for writing…

More Details

Quick Contact Form