nozavroni / csvelte

🕺🏻 CSV and Tabular Data library for PHP
http://phpcsv.com/
Other
6 stars 0 forks source link

Peruse all of PHP's new features since you released last version #49

Open deni-zen opened 8 years ago

deni-zen commented 8 years ago

The last time I released any version of any PHP library code was pre-PHP5.3. There have been a TON of features added to PHP since then. Some of which I have barely even had occasion to learn and use yet. Take a look at the new features and play around with them. See what you can use that genuinely improves the library in some way (definitely don't use new features just because they're shiny and new... I've made that mistake in the past).

Here is a great place to start, as far as finding and playing with all the new features: http://php.net/manual/en/appendices.php

And here are a few features I can think of off the top of my head that I would definitely like to find the time to play around with when I get the time:

deni-zen commented 8 years ago

I remember reading on one of those "new features for PHP5.x" pages that iterators can now support different types for keys when iterating. See if you could do something like this:

foreach ($reader as $line_no => $row) {
    foreach ($row as $column => $data) {
        echo "Row is: " . $row->getLabel() . "\n";
        echo "Column is: " . $column->getLabel() . "\n";
    }
}

The key() method for the inner iterator would return a column object. Try it.