01 May 2013 - After the site upgrade, all passwords were reset and you will need to ask the site for a login reset on your first connection.
Earlier today, David Soria Parra declared a feature freeze on PHP 5.5 and tagged php-5.5.0beta1, but not before merging in pull request #257, which includes my humble addition to the PHP programming language: array_column().
The story of array_column() begins at PHP Tek in 2008. As I recall, it was Spooons who suggested it to me. It is functionality that nearly every developer has to implement in user-land code at some point in their careers, so I felt it only natural that it be built into the language, so I did just that.
My original patch for array_column() was written for PHP 5.2, but it sat around collecting dust for many years, until April of last year, when PHP moved to git and GitHub. That’s when it became easy enough to apply the patch and send a pull request, which I did. It wasn’t quite that simple, though, since I had to follow the official PHP project RFC process, but it wasn’t a pain either.
My goal for array_column() was simplicity. Many implement the functionality in different ways, and many call the function by other names (such as “pluck”), but I wanted to keep it simple and recognizable. It follows this function signature:
1 array array_column(array $input, mixed $columnKey[, mixed $indexKey])Given a multi-dimensional array of data, array_column() returns the values from a single column of the input array, identified by the $columnKey. Optionally, you may provide an $indexKey to index the values in the returned array by the values from the $indexKey column in the input array.
For example, using the following array of data, we tell array_column() to return an array of just the last names, indexed by their record IDs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 <?php $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe' ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith' ), array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones' ), array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe' ) ); $lastNames = array_column($records, 'last_name', 'id');If we call print_r() on $lastNames, you’ll see a resulting array that looks a bit like this:
1 2 3 4 5 6 7 Array ( [2135] => Doe [3245] => Smith [5342] => Jones [5623] => Doe )And that’s all there is to it. I hope you find my little addition to the PHP language helpful. I had a lot of fun writing it, and following the PHP RFC process was a great learning experience.
Twitter pretty much killed blogging for me. When I signed up for the service six years ago, I was blogging quite a bit, but Twitter’s rapid-fire, ultra-short status updates have given me a 140-character attention span. Not only did I stop blogging, but I stopped reading blogs, too. Reading and writing became a chore. While I could fire off a message on Twitter within minutes or seconds of crafting it, blogging was an endeavor that took much longer—hours or even days, at times.
You see, the thing is: I care about the words I write. Probably too much. But with Twitter, I stopped caring. Its ephemeral nature means I don’t have to care. Until recently, even searching for posts on Twitter only went back so far. When I blog, I have to read and re-read the words I have written, over and over. This doesn’t stop after I finally decide to publish a post. Instead, I continue to pore over my post, reading it in its published form and eagerly awaiting potential comments. I’m doing it even as I write this. It can be stressful.
When Google announced this week their decision to shut down Google Reader, it stirred up unresolved emotions in me. I know that sounds silly, but while I haven’t been reading or writing blog posts very much over the last six years, the concept of the blog still holds a dear place in my heart. Blogs are important communication and knowledge-sharing tools. They have revolutionized the way we spread information (or mis-information). I believe they are still important and have a continuing part to play in how we communicate with each other. Without the concept of the blog, it would have been impossible for many of the folks we consider leaders in our various technology communities to have had a platform to share their voices and ideas.
Earlier this year, I made a resolution to myself to begin reading blogs again. I returned to the Google Reader account I had set up long ago and connected it to NetNewsWire on my desktop and phone. I have been pretty good about reading things, and I have tried to treat it a bit like I treat Twitter; if I get behind on reading, I just “mark as read” and continue on, without stressing over it. Some of the things I’m reading have been inspiring me to write again, and I felt it was only a matter of time before this incessant writer’s block was broken and the words began flowing freely again. I believe that time is now.
This isn’t a post to discuss the ramifications of Google’s decision to pull the plug on Google Reader. Nor do I want to consider whether blogs are dying. Those are thoughts better left to other bloggers. What I do want you to think about, however, is how blogging has affected you, whether through your own blog or the blogs of others. Has it helped you be more successful? The answer for me is “yes,” and for this reason, I resolve to read even more, be liberal with my comments on others’ blogs, and write without fear.
Thanks goes to Chris Shiflett for inspiring this post. Be sure to take time and read his original Ideas of March post from 2011, as well as his most recent one.
Recent comments
43 weeks 6 days ago
44 weeks 5 days ago
45 weeks 2 days ago
47 weeks 5 days ago
1 year 16 weeks ago
1 year 19 weeks ago
1 year 23 weeks ago
1 year 23 weeks ago
1 year 23 weeks ago
1 year 40 weeks ago