Swizec Teller - a geek with a hatswizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Senior Engineer Mindset cover
Learn more

    What I learned of PHP by ignoring it for three months

    When I took a break from php three months ago I'd been up to my shoulders in the technology for about five years - I remember my first interactions with the language were figuring out whether I need to use .php3 or .php4 or just .php file extensions. But that's not very interesting.

    A more interesting tale to tell is perhaps how for the last few months I was growing increasingly frustrated with my job, my work environment, my skills toolkit and simply the whole LAMP web development stack. It was time to take a break ... it was a lot later that I discovered a cool TEDtalk on the topic, watch:

    But anyway, onwards to what I'd learned.

    Lessons that can only be learned by staying the fuck away

    This week my PHP hiatus saw the beginning of its end, I had to get a freelancing job to pay bills and other such nuissance - since PHP and Javascript seem to be what I'm most popular for in the community that's the easiest thing to get a job for. And to be honest, I'm not really fluent enough with anything else to do it for real money.

    So earlier this week I had a meeting with the team lead of the project to give me a short tour of their, dare I say it, very well designed framework, and I realised how much extra work needs to be done by the framework just because PHP is such an incredibly lame language.

    1. PHP doesn't have support for that thing where you can use objects right out of a function. So we need a getScalar, getString, getRows, getRow function instead of a lovely getValue, ""+getValue(), getRows() and getRows()[0] system. Why php, WHY don't you support this?
    2. PHP also can't do inline arrays, objects and tuples. This is great for passing data around in a descriptive way and PHP fails completely. Why can't I do a return {x: 0, y: 100}? Or something like that? It's silly that I'd have to create a whole new Vector class that doesn't do anything other than hold two values.
    3. Another thing PHP desperately needs are keyword arguments, or whatever they're called. It should be possible to call a function that has default values and define specific arguments without having to define all the other arguments because the one I need to set happens to be last. Seriously, what if the defaults suddenly change? Do I go through all the code to pass the correct defaults for that one argument I actually need? This could be solved by passing an object around but what's this? Objects are a pain to create? Right ...

    So I guess that makes for almost one thing I've learned per a month of abstinence. Not the best ratio by all means, but it's silly to find that such a modern language used by so many people would be such an utter failure on many points others, not unlike Lisp, have solved half a century ago. What the flying fuck!?

    Did I miss anything? What else does PHP do well and what does it do poorly?

    Published on October 23rd, 2009 in food for thought, PHP, Programming, Uncategorized

    Did you enjoy this article?

    Continue reading about What I learned of PHP by ignoring it for three months

    Semantically similar articles hand-picked by GPT-4

    Senior Mindset Book

    Get promoted, earn a bigger salary, work for top companies

    Learn more

    Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

    Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

    Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

    Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

    Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization

    Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

    Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created by Swizec with ❤️