Tag Archives: PHP

I feel like a scuba debugger

I’ve just spent the last two days trying to smash a treacherous bug in a bunch of quite old PHP scripts: each file was very “simple”… no classes or functions, just a black forest of nested if/else statements with a few redirects here and there. It was so messy that I was forced to diff [...]

Filter chains using reflection

A very common problem is submitting each object of an array to a set of tests: if a given object fails a given test, the system marks the object as “failed” without running the remaining tests.
The classical solution is writing a class for the test, with a method for each test and another method that [...]

General belief about memory_get_usage

I’ve discussed with a friend the effect on memory of assigning strings by reference (or by value) within PHP5. There is a false belief about it: I’ve just written a short script that, using memory_get_peak_usage and memory_get_usage, reports the memory used by emalloc in the following case

$a = fit_the_string();
$b = fit_the_string();
$c = [...]

DokuWiki passes E_STRICT test, others don’t

Having read that
The Zend Framework codebase must be E_STRICT compliant.
on the latest version of a XAMPP server I’ve tested with E_STRICT the three LA(M)P programs that I mostly use: DokuWiki (2007-06-26b), Joomla! (1.5 RC3) and WordPress (2.3.1). Of course DokuWiki is the simplest of them but I was surprised to discover that it can be [...]

An accessible email cloaking technique

I suppose that you do not write your email on webpages but if you have to deal with people that do want to, you have to find some trick to protect them.
I’ve found a good list of techniques to achieve this task but when you can’t use anything like CSS, images or JavaScript it’s harder [...]

mkdir, what else? :)

Reading the referers of this website, I found that someone reached it querying a search engine for
PHP script to create folder recursively
You can use this one-liner:
mkdir(’/the/new/folder/tree/that/you/want’, 0755, true);