Kore and me held our talk about "PHP best practices" this morning at the Free and Open Source software Conference and were quite successful, AFAICT. There were about 50 attendees, which listened concentrated over the whole time. The talk contains an overview on how to behave when coding PHP in respect to
General guidelines
Security
Performance
and gives a general overview on useful tools around PHP development.
You can find the slides in the php.net talks section.
Correction, June 30th 2006: Ok, the guys from my usergroup convinced me to correct this. There were about 100 attendees in the talk, not only 50. :)
If you liked this blog post or learned something, please consider using flattr to contribute back: .
You wrote in there: "allways use ++$i instead of $i++" (in for loops). Why is that?
Link to comment
Oh, the wording was incorrect here. I rephrased it to "Where possible use...". Surely it is not allways possible, since post- and pre-increment operators are still semantically different. Anyway, there are tons of places, where ++$i is as appropriate as $i++ and the first one is simply much faster in PHP.
Thanks for the hint!
Interesting. I'd have thought that two so nearly identical functions would be nearly identical in speed as well. But the difference is indeed significant and in such a for loop, I can't think of any (other) reason to prefer one over the other.
In my quick benchmark (PHP 5.1.4 on Debian Linux) an (empty) for loop with ++$i was 11% faster than one with $i++.
Yeah, that is what we gathered also.
Link to commenthellloooo
Link to commentFields with bold names are mandatory.
PHPUGDO plans "PHP introduction workshop"
During our last usergroup meeting here in Dortmund (last Thursday), the idea came up to organize a "PHP introduction day", if there is enough interesst in the local area. The idea resulted from the success of Kores and my "PHP best practice