Skip to content

My latest book, “Iterating PHP Iterators”

PrintDear Reader,

I am happy to announce the latest in my “Learn One Thing” books series, “Iterating PHP Iterators”.  My friend Christopher (@assertchris) Pitt summed it up best in his review of the book.

This is a great book for beginners and intermediate developers. It’s a comprehensive introduction to iterators and some of the implementations that ship with the SPL.

That is exactly what I was going for, a book for beginner and intermediate developers. I hope it helps someone along their journey.

Early Adopters Save

As is my tradition, this book is available to early adopters at a lower rate. Until April 11th, 2015, this book is available for $5.99. After that it goes to it’s retail price of $9.95.

Back Story

Each book has a story. This one almost didn’t happen. I started this book over a year ago. I wrote about 75% of it and then got distracted with another project. I set it aside and forgot about it. I’ve even written another book, “Culture of Respect” between when I started this one and finished it.

While I was writing “Culture of Respect” I noticed it in Dropbox and remembered that I never finished it. So in Feb of this year, I picked it back up, finished it, fleshed out the code, polished it up, and pushed the button.

Thank you

I have to say a huge thank you to Christopher Pitt.  I sent him a copy for review, he sent me back 12 PRs with formatting issues. Thank you Chris for embodying the PHP Community’s “Pay It Forward” attitude. I hope to be able to repay the favor one day.

Until next time,
I <3 |<

Reordering Style Sheets in WordPress

Dear Reader,

Updated the code. The original code would not work properly if the array had any missing keys. (e.g. a style sheet was unenqueued). To fix this, I use array_values() to remove any gaps in the index before processing it.

The Lovely and Talented Kathy is responsible for how all our websites look here at EICC. If it looks good, she did it, if it doesn’t look good, I’ve obviously been mucking around in it and she will eventually fix it. Occasionally, she has need for my particular skills. Compared to her artistic pen strokes, my code in a sledge hammer, but when dealing with WordPress, sometimes a sledgehammer is what is needed.

With Stylesheets, order matters

I’ll never understand why theme and plugin authors don’t understand this one simple idea. User stylesheets should be loaded last. They should be able to override anything and everything because the end designer, not you the theme or plugin designer know what is best. Still there are some that simply insist that the the user’s stylesheet not be the last thing enqueued to load. I’ve grown tired of fixing this on each and ever site we have by digging into the functions.php of the last site we built to figure out how I did it. So I’m blogging my solution.

Hacking WP_Styles

What I found is that WordPress has a wonderful object called WP_Styles When theme and plugin authors enqueue styles, it adds them to this object. (For fun one day drop a print_r($wp_styles) into your functions.php. There is a LOT of stuff in there.)

One of the properties that I noticed when studying WP_Styles was the queue array. Looking at it, this was a list of the tag ids of the stylesheets to be queued. Examining the source of the page that was output, it was obvious that they were in the same order as the stylesheets were output. So I decided to test and see if the order of the array controlled the output order. Sure enough it did. So from now on, this little piece of code lives in the functions.php of every child theme she creates.

The Code

To use this, just identify the IDs of the style sheets you want to move, and add them to the $keys array.

<link rel='stylesheet' id='bootstrap-basic-style-css'  href='/style.css' type='text/css'/>
<link rel='stylesheet' id='it-exchange-child-theme-css-css'  href='/style.css' type='text/css' />

The stylesheets above are the two I have listed in the function below. Notice that each is appended with an additional -css. Make sure you do not put that in the code below.

function cal_adjuststylesheets() {
  global $wp_styles;
  $wp_styles->queue = array_values($wp_styles->queue);
  foreach($keys as $currentKey) {
    $keyToSplice = array_search($currentKey,$wp_styles->queue);
      if ($keyToSplice!==false && !is_null($keyToSplice)) {
        $elementToMove = array_splice($wp_styles->queue,$keyToSplice,1);
        $wp_styles->queue[] = $elementToMove[0];
add_action( 'wp_print_styles', 'cal_adjuststylesheets',99);

The last line calls this code just before the stylesheets are printed. Make sure you put that in there or WordPress will ignore it.  Order is important as the style sheets you specify will float to the bottom of the list but be in the order that you have specified.



Drop that little snippet in your functions.php and you never have to worry about your stylesheet being listed before the one you want to override.

Until next time,
I <3 |<

Airfare and Two Nights in the Hotel

Dear Reader,

This is a rant, feel free to skip it. Also, I am talking about myself in this rant. There are a lot of other speakers who fall into this bucket with me, but everything I’m saying here applies to me.

The Problem

PHP conferences are changing very slowly, and not in a way that I like. I blame myself. As a frequent speaker I am getting lazy. I get caught up in the excitement of the CfP, I write up 5-10 abstracts and shotgun them into the CfP system hoping that something hits the mark. I’ve not actually written these talks. In most cases, I’m pretty sure I can get 45 minutes on the topic, but I don’t know for sure because I’ve not bothered to write it yet. Adam Culp talks about this very thing in his post “Are Conference Talks Getting Too Soft?“.

The problem is that I’ve lost my focus. My focus should be the cool thing am I dying to share with other developers.  Instead, I’m chasing that “Airfare and two nights in the hotel”. I know this because my focus is writing abstracts. That and abstracts that don’t get accepted, I never bother to write. This is backwards. I should be so excited about sharing something that I write it up anyhow. I should blog about it, prepare the slides, and contact my local PHP User Group and see if they will allow me to present it. The local PUG is the lifeblood of our great community. It is important to me that I support them first, then conferences.

Being the Change I Want to See

To help me refocus, I have set myself two goals for 2015.

  1. I want to present at 5 local PHP User Groups in 2015.
  2. I will not submit to a conference any talk that I have not written and presented at a local event. (The exception I am making is keynotes because some conferences I speak at ask me to write a new keynote.)

I am refocusing my speaking efforts on talking to the local level. There are probably 5-6 PUGs I can reach by car and can speak at. So as I come up with an idea for a talk, I will first submit it to any and all PUGs that will have me. Then, if that talk seems solid and is helping people, I will submit it to conferences.

This is not to say that I won’t be submitting talks to major conferences, but I will not be submitting talks that I’ve not already written and presented at least once locally.

Looking to Others for Help As Well

I am privileged enough to be asked to help score talks for several of different PHP conferences. in 2015, I will start be a lot more picky in the talks for which I vote. I will look for – and up vote – talks where the presenter makes a note that they have given this talk at a local event already.

Wrap Up

So next time you are starting at a CfP, don’t brainstorm a lot of talks, submit them all and write the ones that get accepted. Look at the talks you’ve done for your local PUG, and submit them. You know they exist, you know they work, and you know you are supporting your local PUG.

Wouldn’t it be great if PHP User Group leaders had to start scheduling talks 6 months out? I’ll take that problem any day of the week. :)

Until next time,
I <3 |<

p.s. If you are considering writing a talk and need some help with your abstract, let me help.

Five influencers you should thank this year for making the PHP community so awesome

Thank You by Adi RespatiDear Reader,

It is no surprise to anyone who has talked to me for more than five minutes that I think the PHP community is the most vibrant and engaging developer community out there. So as we approach the end of the year, I am going to list out the influencers that help keep this community at the top. These are the people that you need to seek out and thank because without them, the PHP community would not be what it is today.

5: Core Developers

Let’s face it, without PHP, there would be no PHP community. So the influencer you need to reach out to and thank is any person you know or know of that has contributed to the Core. I’m going to also include all those who contribute to the manual. PHP is a great language and it has a great manual.

4: User Group Leaders

User Group leaders are awesome because every month they organize their small corner of the community. They do this because they believe in the community. It is largely a thankless job. Rarely do people stop to say thank you when it goes great. Trust me though, if something goes wrong, they hear about it. Reach out to your local PHP User Group leader and thank them for all they do for the PHP community.

3: Conference Organizers

If you have never organized a conference then you have no idea how much work it is to put one on. Whether it is a commercial conference or a community conference, the time and effort is largely the same. PHP is blessed with some great conferences both commercial and community. Take some time this week to reach out to those who organize your favorite conference and tell them how much you appreciate it. Let them know if something you learned at their conference had a positive effect  on your life.

2:Conference Speakers, Bloggers, and Teachers

Preparing a technical talk, tutorial length blog post, or a class that teaches something meaningful is a difficult process. Many people will spend weeks or even a month working on a single talk that is over in 60 minutes. These people do this largely to help others learn. They share what they have learned so that other developers can understand. If you know someone who regularly speaks, blogs, or teaches in the PHP community, reach out to them and tell them thank you.

1:Any developer using PHP

All of us together make up the PHP community. If you write code in PHP – for your day job, for your side projects, for whatever – you are part of the PHP community. Instead of urging you to say thank you to other developers though, I am going to take this time to say thank you to you.

If you write code in PHP, thank you.

  • Thank you for choosing PHP
  • Thank you for using it to create cool things
  • Thank you for helping make PHP power over half of the web.

Wrap Up

If you were looking for a list of 5 specific people to follow/thank/put on a pedestal, that’s not what I do. The PHP community is about all of us, not an elite few.

As you are winding down your 2014 and thinking back, think back to the PHP community members that have had a positive impact on your life and/or career and reach out to them personally to say thank you.  Make sure though you take time to reflect on the PHP community as a whole. Take a moment and tweet or Facebook a thanks to the entire community for being such a welcoming and awesome community. Then go get involved in your local PUG.


Until next time,
I <3 |<


Photo Credit:

Thank you by Adi Respati

I have a cure for the “Eli Travel Curse”

Dear Reader,

IMG_0370If you are a speaker in the PHP community, you know about “The Eli Travel Curse”. For everyone else, basically we all know that you never ever travel on the same flight as Eli White. Heck, most of us won’t share a cab with him to the airport, and we get nervous if we see him at an adjacent gate, or even traveling on the same day. :) This makes traveling to PHP conferences tough because Eli is a beloved fixture at most conferences. Dont get me wrong, we all love Eli, but he has the absolute worst luck in traveling.

I’m happy to say that I have a cure for those who are “Eli adjacent” when traveling. The picture above is my magic talisman.

WAIT! Before you realize you recognize what it is and rush out to get yours, this is a special talisman that can’t be simply purchased off the shelf. Yes, this is the talisman that comes on most bottles of Pyrat Rum. However, this particular one is off a bottle of Pyrat rum given to me by Eli himself.

Eli and I share a couple of common points in our job timeline. The first one was that I preceded him as the Editor-in-Chief for Zends DevZone. As a thank you for some small pieces of advice I gave him while he was at Zend, Eli presented me with a bottle of Pyrat Rum at ZendCon 2009; this is the talisman from that bottle. I’ve had this talisman hanging on every backpack or bag I carry with me since then. I keep it with me to remind me of this important lesson.

No matter who asks you, and no matter how insignificant you think your help is, you have no idea how much or little affect others when you help them. So help everyone you can, as often as you can.

Since I hung this little gift from Eli on my backpack, my travel woes have been cut significantly.

  • I’ve not had a flight canceled
  • I’ve not been stuck in a strange city
  • I’ve only had a handful of flights delayed…way down from pre-talisman days

Now you can attribute all of this to the fact that the airline industry is getting better at service. You can say it’s because I now primarily fly Southwest and they have a very good track record. Me? I know the real answer.


  1. I would have never received my magical talisman if I hadn’t been willing to help a friend when he asked. Since then I’ve learned that it doesn’t have to be a friend, I do my best to help everyone who asks…and a few who don’t.
  2. If you want to be safe in your travels, you gotta get Eli to give you a bottle of rum. :)

Helping people, it cured the Eli travel curse for me! :)

Until Next Time,
I <3 |<

p.s. Pyrat Rum is now one of my favorite rums of all times. Good stuff if you can find it.