Category Archives: The Know Your Language Department

PHP UTF-8 String Length

If you’ve got an UTF-8 encoded PHP string (e.g. when working with DOMDocument) and you don’t want to rely on the mbstring extension to get it’s length, this can be solved with a simple regular expression (as the string does … Continue reading

Posted in Pressed, PHP Development, The Know Your Language Department, PHP Library | Tagged , , , , , , , , | 1 Comment

Improved handling of HTTP requests in PHP

Improved handling of HTTP requests in PHP Merci beaucoup Nicolas Grekas for compiling this in-depth! Read On: getallheaders available for FASTCGI in PHP 5.4 (18 Jul 2011)

Posted in Linked, PHP Development, The Know Your Language Department | Tagged , , , | 1 Comment

Don’t tell nobody!: class IntegerstringArray IMPLEMENTS ArrayAccess

Posted on by | Leave a comment

Protocol of some PHP Memory Stretching Fun

The know your language department was having a day out with the gang from the know your runtime department. The topic of today was to play with the PHP memory limit, let’s grab the laptop’s shell: $ php -d memory_limit=1g … Continue reading

Posted in PHP Development, Pressed, Reports, The Know Your Language Department, Uncategorized | Tagged , , , , , | Leave a comment

PHP: Empty() is the Opposite of a Boolean Variable

From the know your language department: It’s already written in the PHP manual, if we could only read it : empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set. So … Continue reading

Posted in PHP Development, Pressed, The Know Your Language Department | Tagged , , | 3 Comments

PHP: is_null() vs. NULL ===

From the know your language department: If you can, go with the identical comparison operator ===. That’s a good approach in PHP for various reasons. Only one example: could be written as: but it is about more than 14 times … Continue reading

Posted in PHP Development, Pressed, The Know Your Language Department | Tagged , , , | 2 Comments

PHP: Casting vs. intval()

Doing a cast like (int) $var instead of the intval($var) function is about 300% to 650% faster. I did some tests out of curiousity in #13317 and those are the results:

Posted in Hacking The Core, Pressed, The Know Your Language Department | Tagged , , , , , , , , | 16 Comments

End.

Finally I come to an end: The good thing about reading source-code written by others is that you can learn something. That can be things to do or to prevent. And sometimes you find something new. I did this week, … Continue reading

Posted in Pressed, The Know Your Language Department | Tagged | Leave a comment