Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Category: php

PHP Idiotic Function Contest

I’m holding a contest about who can find the most idiotic PHP function. Rules: It has to be an official part of PHP (i.e. can be found in the manual). Leave your suggestions in the comments. I hereby nominate the runkit_constant_redefine() function. The manual entry says: runkit_constant_redefine – Redefine an already defined constant There is […]

PHP MySQL tips

Interesting PHP MySQL tips. Some comments: 2. Always prepend the table name to the field. E.g. ProductName, SupplierPostCode. This refers to field name aliasing, not to actual field names. He doesn’t suggest that you actually name your fields like that in the table, but only when you select them: SELECT product.name AS product_name instead of […]

PHP Namespaces committed

Gravitronic lets us know that a patch that implements namespaces in PHP has now been committed. The last time I took a look at the roadmap for PHP6, it was still undecided if namespaces would make the cut. Seems like they have now (although they could still revert the commit, like they did with namespaces […]

What’ll PHP6 bring us?

CorePHP took the PHP 6 Developer Meeting notes minutes, which covers the discussion on the upcoming changes in PHP6, and made it into an nice summary article. Interesting stuff. Looks like they’ll be breaking a lot of stuff such as removing the dreaded ‘Register Globals’ option, Safe mode and Magic Quotes. Good. This piece of […]

PHP: Directly Assign Exploded Parts To Variables

Many languages (amongst them Python and Perl) provide a way to directly assign the parts of a split string to variables. The syntax usually used is something like: firstname, lastname = “John,Doe”.split(“,”); or something similar. PHP does not support such a syntax. The programmer instead has to perform all spliting, checking and assigning himself. This […]

Ctags and Object Oriented PHP5

About CTags Ctags is a great utility. It creates a file with a list of ‘tags’ that are found in various program sources that it finds in the directory where you run it. These tags can then be read by editors so that they know where in the source to find, for instance, the definitions […]

Learn your language’s basic features

Sometimes I’d really like to bash in my own head with a 2×4. I just spent at least 20 minutes figuring out why the boolean expression ($options & PW_SORT_DATE == PW_SORT_DATE) didn’t evaluate to true, even though $options had a value of 2 and so did PW_SORT_DATE. Then I suddenly realised that PHP’s == operator […]

RSS2MySQL v0.1

For a colleague of mine: RSS2MySQL v0.1. A Small script which reads in an RSS feed, takes the news items and then puts them in a MySQL database.

PHPBar: The PHP reference in a sidebar

PHPbar is a pretty nice sidebar for your browser which contains a quick reference for PHP.

PHP Cheat Sheet

Downloaded it today, and it’s already indispensable: PHP Cheat Sheet

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.