Is Singleton Evil?

A design pattern that promises uniqueness but can't even handle a clone. Step by step, I break down how every attempt to save the singleton's life – whether it's testability, global state, or repetitive code – inevitably leads to its funeral.

Twitter for PHP

A tiny PHP library that handles OAuth so you don't have to. Post updates, attach photos, search hashtags, pull timelines – all in a few lines of code. Because life's too short for hand-rolling cURL calls against Twitter's API.

Finally, the Truth About XHTML and HTML

Overlapping tags, ambiguous markup, permitted hacks – all myths. The facts show that the difference between HTML and XHTML is surprisingly close to zero. The real story lies elsewhere: in the transition from SGML to XML, which brought its own set of problems.

Ruby on Rails? No, Thanks.

Ruby lets anyone redefine any method in any class, and Rails does exactly that to the standard library with a big smile. Sounds like freedom? It's the kind of freedom where someone else's “improvement” silently breaks your code. A good framework, sure, but one that makes you its servant.

The stretched buttons problem in IE

IE on Windows XP turned longer form buttons into jagged monsters. All it takes is overflow: visible and the elegant CSS selector input.button[class], which IE ignores – a valid fix without underscore hacks and conditional comments.

Texy2 – Even More Sexy!

How to design software the right way? Write it, figure out what you need, and then write it again. Texy2 is exactly that second attempt – precise, maximally flexible, and capable of handling even crazy edge cases. I almost didn't release it, but in the end they talked me into it.

DOMDocument::registerNodeClass is great

The documentation is silent, Google is silent, but I'm not. registerNodeClass() lets you sneak your own classes into DOMDocument instead of the standard ones – and suddenly every parsed element has your methods. Small function, big difference.

PHP: The Dark Magic of Optimization

Changing a few characters in the source code and the script runs 600× faster. You just need to know when PHP silently duplicates a huge array behind your back – and why references and refcount inside zval structures are to blame. No black magic, just white.

HTTP Redirection

Extremely long numbers, meaning those with more than one digit, I simply can't remember. So I wrote myself a cheat sheet: what HTTP codes 300–307 mean, when to use which one, and why 302 is the black sheep that everyone loves and nobody respects.

The magic with conditional comments

Everyone knows that downlevel-revealed conditional comments are invalid. Everyone is wrong – all it takes is cleverly breaking and reopening an HTML comment in the right places. A few extra characters and you have a fully valid markup that IE ignores and other browsers see.

That's all. More articles are on the way.

phpFashion © 2004, 2026 David Grudl | o blogu

Ukázky zdrojových kódů smíte používat s uvedením autora a URL tohoto webu bez dalších omezení.