Tag Archives: SPL

Assorted SPL Iterator Examples

This is an assorted list for three SPL iterator resources out there in the net. I’m sure there is more, so feel free to leave a comment I’m happy to add them. spl-examples (salathe) The idea is to have you … Continue reading

Posted in Hakre's Tips | Tagged , , , , , , | 4 Comments

Getting N Random Elements out of an Iterator – RandomIterator

Considering there is an Iterator or Traversable with an unknown number of elements, I wondered if it is possible to get one or more random iterations out of it.

Posted in Developing, Hakre's Tips, PHP Development, Pressed | Tagged , , , , , , | Leave a comment

Exception Best Practices in PHP 5.3

Exception Best Practices in PHP 5.3

Aside | Posted on by | Tagged , , , , | Leave a comment

Parsing CSV files with PHP – SPL-Style

There are some CSV (Comma Separated Values) related string and file functions in PHP. But when it comes to deal with CSV files, there is another gem: SplFileObject (PHP Manual) built-in. The class makes it even more easy to iterate … Continue reading

Posted in Hakre's Tips, Pressed | Tagged , , , , , , , , , , , | 2 Comments