Learn a Language: PHP

John Martin
Martinsoft
Published in
5 min readFeb 13, 2019

Learning to code requires a HUGE investment of time and energy. For newcomers it’s also difficult to know where to start because there are so many languages to choose from. Through my Instagram account I’m often asked:

“Which programming language should I learn?”

I wanted to be able to give a better answer than “it depends”, so with this Learn a Language series, I hope to build a resource that’ll help people decide for themselves which language they should invest their time in learning!

With help from other developers across the tech community, each article will give an overview of a popular programming language, from a developer experienced in that language. We’ll look at what each language is good at, what it’s not so good at, and the tools/resources that can help you get started.

In this article, Nadja Summerscales-Gunn aka @_codequeen gives an overview of PHP!

Nadja — @_codequeen

How long have you been working with PHP?

3 years exactly.

What made you choose to work with PHP?

I sort of just fell into it. I started building Worpdress sites at my first job & got more interested in PHP as when I started working on more complex features. My love for PHP grew when I started working at Resume Library. We use it in various different technologies and you really start to learn how powerful it is.

What sort of things is PHP well-suited for? When should someone consider using PHP for their project?

PHP is a server side scripting language. It can be used for dozens of different tasks such as:

  • taking information from web based forms and storing it in a variety of different ways (e.g. storing it in a database, setting cookies for later, sending emails etc)
  • running threaded discussions on your site
  • authentication & tracking user activity
  • serving XML pages
  • building an API
  • building scripts to make life eaiser

I mainly use it for building web applications or even writing handy scripts to make my life easier!

A lot of people look down on PHP for being a synchronous programming language – meaning that it’s used for building reactive programs. It’s mostly overlooked due to the popularity of JavaScript, but can be manipulated to do the same things.

If you also know other languages, how does PHP compare to these?

In terms of syntax, PHP is very similar to C. If conditions, for and while loops. Function returns are also similar to languages such as C++, C#, Java & Perl. For example, boolean type conversion rules: non-zero values are interpreted as true and zero as false, as in Perl & C++.

Are there any types of project / task that PHP would not be a good choice for?

You wouldn’t use PHP to build mobile applications or GUI applications. Even though you could most definitely use PHP to synchronise across multiple platforms – you wouldn’t be able to build native applications with the language.

What do you particularly like about coding in PHP?

I personally find it really easy to read & write. Other’s may say that it encourages bad coding habits but I think it’s unfair to blame that completely on the language.

If you understand how a language works i.e. debugging, error handling etc – you can write very efficient, clean code. Trust me, I pride myself in ‘pretty’ code.

There are also so many tools to help you get started! PHP has been around for years & there is a tonne of great documentation out there – go use it!

What are the things that frustrate you when working with PHP? What possible sources of pain or frustration (if any!) should people be aware of before they start learning PHP?

Use the try/catch block where you can. PHP doesn’t gracefully handle errors & a try/catch will deal with the issue gracefully – it’ll save you from any embarrassing errors.

One of my other bug bears is the many many frameworks with bad documentation. CakePHP is one of these in my opinon, but I guess this could be the same for any other language.

What dev tools do you use when working with PHP? What other tools are also popular?

Nadja shares her journey as a PHP developer on Instagram! Go follow her!

Which resources would you recommend for people looking to learn PHP?

What are the popular libraries or frameworks that people should also consider learning with PHP? What do these libraries / frameworks do?

  • CodeIgniter – this is really easy to learn & has great documentation!
  • Laravel – this is also really easy to learn, has great documentation, Laracasts & can do a lot more with little!
  • CakePHP – very easy to setup initially, however the documentation isn’t as clear cut as Laravel & CodeIgniter
  • Zend – a little more difficult to configure but very powerful once you’ve got it setup.
  • MAMP || XAMPP – virtual servers.

Anything else you want to say about PHP?

Before taking judgement on PHP from any of your peers, please give it a go – you never know, you might love it!

Thank you so much Nadja! Where can people find you online?

Thank you so much for reading! I hope you found this article useful!

If you know PHP and have suggestions for other resources that beginners should know about, feel free to leave them in the comments!

Other languages will be coming soon!

You can find me:

Instagram: @martinsoft

Online: https://martinsoft.net

I also co-host @meetupandcode, a regular meet-up in London for devs with any level of experience. Join us!

--

--

John Martin
Martinsoft

Full-stack developer with a focus on iOS. Founder and freelance dev @martinsoft. Passionate about all things Apple, and using tech to make life better.