Before you begin to learn PHP, it might be wise to take a moment to plan your approach to learning the language.
Professional developers that have learned PHP have spent a significant number of hours learning their craft. To emulate them, you will need to ensure that you are motivated to do the same, and ideally able to learn PHP quickly and efficiently. The slower and more inefficient your learning methods, the longer it will take for you to get a job in PHP development or build the application you have in mind.
An even worse consequence of a slow and inefficient learning approach is that you will be more likely to give up on studying! Research conducted by Harvard and MIT universities found that only 4% of students that sign up for online courses complete them.
So, how can I help you avoid becoming another one of the 96% of people who give up?
Well, I’ve put together a list of 10 tips to help you learn PHP. The tips should help you approach learning PHP effectively, keep you motivated, and also avoid some potential difficulties.
Let’s get right to ‘em!
Table of Contents
- 1. Tip 1 – Be confident you want to learn PHP
- 2. Tip 2 – Keep your projects in mind
- 3. Tip 3 – Learn HTML first
- 4. Tip 4 – Active learning over passive
- 5. Tip 5 – Don't be afraid to break things
- 6. Tip 6 – Turn on Error Reporting in PHP.ini
- 7. Tip 7 – Be careful with the syntax
- 8. Tip 8 – Keep your code readable
- 9. Tip 9 – Try to solve problems yourself
- 10. Tip 10 – Understanding jargon
- 11. Conclusion
Tip 1 – Be confident you want to learn PHP
If you have arrived on this article as a newcomer to programming, you might not have a strong preference about which programming language to learn. While that's not necessarily a problem, it could lead to a problem later down the line in which you realize that a different programming language is better suited to your aspirations. PHP is a server-side programming language commonly used in web development; if you realize in a couple of months that what you actually want to do is to work at Rockstar and help build the next edition of Grand Theft Auto, then you would have been better served learning a programming language commonly used in game development such as C or C++. There are lots of great reasons to learn PHP, including:
Latest Udemy Coupon Found:
AS LOW AS $12.99
Don't wait - pick out the best Udemy course & use this Udemy coupon code for a huge discount. Get a skill you've always wanted for way less!
- You want to take your WordPress skills to the next level. As of September 2018, 7% of all websites use WordPress. As WordPress is powered by PHP, that creates a huge demand for PHP skills. And if you wanted to use other content management systems, such as Joomla or Drupal, I'm pleased to tell you that they are built with PHP also.
- PHP is considered to be relatively easy to learn compared to other programming languages.
- As PHP is native to the web, you'll be able to put simple projects online a lot quicker and with less difficulty, than you would be able to with some other languages, meaning you will see results for your efforts much quicker than if you were to learn another language.
So, before you start to learn PHP, make sure you consider these so that you can be confident that PHP serves your needs.
Tip 2 – Keep your projects in mind
Now that you know why you want to learn PHP, it is also useful to have an objective in mind for what you want to do with it. Learning PHP will be a long process, and staying motivated will be easier with an end goal in mind. Online courses, such as BitDegree's Learn PHP Online course, keep the learning process interesting and interactive by having you build a project as you learn the fundamentals of PHP development. This is a great way to make the learning process interesting and relatable, but even better is having the idea of your project in mind. If you keep your project in mind, you will have a greater incentive to remember what you learn if you want to apply it to your project. You will need to continually practice your newly developing PHP skills, and it is usually easiest to motivate yourself to work on your project. You can even build different versions of your project as your skills progress. For example, you could initially create a simple contact app that has basic functionality to add and delete contacts. As your skills develop you could hook this up to a database. Later you could add more advanced functionality, before putting it live and inviting your friends to submit their details. Before you know it, you could be the owner of one of the world's largest social networking sites connecting more than a billion people and generating billions of dollars in advertising revenue. Who knows?
Tip 3 – Learn HTML first
While PHP is a fine choice as your first programming language, it shouldn't be your first step in web development. If you haven't learned it already, you should dedicate some time to learning HTML before you start to learn PHP. HTML is a markup language, rather than a programming language, that forms the basis for web pages. This means that the code you write represents the basic elements of a web page, such as images or text. You can't program any functionality with a markup language, which makes it relatively simple to learn, and has also created the need for a language like PHP to be used in addition to HTML to make websites more dynamic. As PHP is generally used to make HTML dynamic, HTML is commonly seen in PHP documents. Not only will HTML be present in most applications of PHP, but it will also be part of many tutorials and lessons on PHP development. Most of these tutorials will simply assume that you already know HTML. So rather than finding yourself learning both at once, take a few hours to learn the basics of HTML. Learning PHP will take months, but the time needed to learn HTML is a matter of hours. You could start with BitDegree's Space Doggos course, which will not only teach you HTML and CSS but will also feature our lovable Doggo!
Tip 4 – Active learning over passive
One of the best ways to make learning more effective is to learn actively rather than passively. To learn passively means to simply watch/read/listen and absorb information. To learn actively means to use what you're learning in a problem or project. Educational professionals seem to be unanimous in their belief that active learning strategies are better than passive ones. The only problem is that creating an active learning experience is generally more difficult than creating a passive one. BitDegree's 'Learn PHP Online' course is a great example of an active learning experience. To advance past each lesson in the course, you have to solve the problem by using what you have just learned in the code editor.
An example of passive learning experience would be watching a YouTube video of an instructor voicing over a slideshow which explains what functions are. Passive learning experiences can still be useful, though. The instructor might offer the best explanation of what a function is that you've ever heard. The advice here isn't necessarily to avoid passive learning experiences entirely but to try to make them active. You could take the examples in the lecture and write them out yourself, making alterations and seeing what happens.
Tip 5 – Don't be afraid to break things
Be careful with this advice. If you are working on a live site, purposefully breaking things is certainly not the best idea. If you are working with WordPress, it is generally advised to leave the PHP files in the WordPress core alone. Don't break those. But in offline project files you create, or in the PHP files in the WordPress theme folders, breaking things isn't a bad idea. You'll learn a lot from putting them back together. This advice doesn't strictly mean you have to break your websites, but rather that you shouldn't be afraid of it happening. Things going wrong is generally an excellent learning experience. The bigger the problem, the better you will remember the solution. For beginners, the interactive code editors in the BitDegree 'Learn PHP Online' course are a great environment in which to experiment. You can rest assured that whatever you do to the code you will be editing, you won't be able to take the whole BitDegree website down so experiment. By the way, if the course exceeds a bit your finances at the moment, you can try to apply for BitDegree micro-scholarships. A sponsor might fund your course fees and help you out with a little reward at the end! If you have a couple of ideas on how to solve a problem and the first one works, make sure you try your second idea too, rather than simply advancing. In web development, there's usually more than one way to solve a problem.
Tip 6 – Turn on Error Reporting in PHP.ini
If you are going to break things, it may be wise to make sure error reporting is enabled. This may well be enabled by default, but in some instances when you break your PHP application, all you will see is a blank screen. To see an error report, ensure that you turn to enable error handling in your php.ini file by using the code: ini_set('display_startup_errors', 1); ini_set('display_errors', 1); error_reporting(-1); That will mean that when you make an error in your code, an error report like the one below (the result of a missing semi-colon) will at least return a somewhat helpful message to help you debug the problem.
Tip 7 – Be careful with the syntax
Tip 8 – Keep your code readable
As you learn to code, you will be learning from instructors that take great care with the presentation of their code. And if you're not... you should find a different instructor. At first, all the spacing, indentations and alignment might seem superficial. If the code works, it works, right? Who cares about the spacing? Well, when you make a mistake or come back to the review the code you wrote a while ago, you will care. Worse still, if your colleagues have to work with your code that you haven't kept readable, you will care even more, because your colleagues will hate you. Well-Written code is essential for dealing with the errors discussed in tip 7. If you put all your code on one line, the computer will be able to read it just fine. But if you've missed a semicolon, you or someone else has to spot that. Which example would be easier to spot a missing semi-colon in?
In case that isn't obvious, it's the same code. The only difference is the spacing. The first version of the code makes it easier to spot semi-colons at the end of each line while having the HTML span tags and opening (<?PHP) and closing (?>) PHP tags in alignment also helps to identify if you simply forget to include a closing tag. The second version is just all the code rammed together. Now you have to check all the code for potential missing semi-colons rather than just taking a quick look at the end of the line. Where do the PHP tags start and end? They have their lines in version one, but you have to scan all of the code from opening tag to closing tag in version two of the code to check they are both there. In addition to keeping your code clean, clear and readable, be sure to make use of comments to remind yourself what you were thinking when you wrote your code. Comments are lines of text that are ignored by the PHP interpreter. You can turn your text into a comment by including two forward slashes at the start of the line.
// Like this.
The computer completely ignores your comments, making them seem kind of pointless. But while code is for the computer, the comments are for the humans. Particularly if you write something complex, comments can be extremely useful for either other people or yourself in the future to understand or remember what your program does. For example, below I wrote a comment above this Wordpress custom query to remind me what it is when I learned it. The comment is the grey text that begins with //.
Comments can be a great way to leave little notes for yourself to help you remember how to do things. As a newbie, you are very likely to re-visit the code you write now in the future. When someone asks you to build something you've built before, referring to the code you wrote and understood before can be easier to use than trying to understand someone else example you found via Google.
Well, it will only be easier if your code is clean, clear, easy to understand and makes good use of comments.
Tip 9 – Try to solve problems yourself
When you do run into a problem, a common reaction is to immediately ask for help.
Now, there's nothing wrong with asking for help. A lot of people would say it should be encouraged. But if you ask someone as soon as you get stuck, you're not going to learn the lesson anywhere near as well as you would have done had you figured out the problem yourself. There is a right time to ask a question.
This might seem like more of an issue at a coding boot camp in real life, rather than online, as in a boot camp you can raise your hand and ask an instructor for help. However, courses like those on BitDegree give you the option to send feedback on any lecture in the course so that the instructor can help you with any problems you encounter.
But remember, when you are learning PHP, you aren't blazing a trail – you are not the first person to learn this programming language.
Plenty of people went before you, and their questions are all over the internet. There are also plenty of people who want to help, and their answers are also all over the internet.
Particularly if you are near the beginning of your learning experience, studying PHP basics, it's extremely unlikely your problem hasn't been encountered before by someone else. So, if you want to find an answer to any problem you have with PHP, then just do what you do to solve all your other problems. Google it!
At the top of the search results, you will find that someone has probably posted an eerily similar question to yours on Stackoverflow.
If you can't find a match to your question, it's also worth remembering that PHP, like every other programming language, has extensive documentation to help its users understand how to use PHP. If the manual is a bit overwhelming, a more digestible PHP knowledge base is available on BitDegree.
Tip 10 – Understanding jargon
One difficulty you may encounter early on when learning PHP is the technical language used by your instructors or in instructions.
A good instructor will be able to explain the PHP basics to you in plain English. But once you get on to more advanced topics, the instructor will need to use more technical language to describe concepts of greater complexity.
It's important that you learn the words in your new vocabulary sufficiently to be able to understand sentences that might use two or more jargon words in them. Unfortunately, it's unlikely you will ever fully understand how to use PHP unless you can understand the difficult concepts behind it, and that means learning a technical language.
A simple example would be understanding 'how to pass a variable as an argument to your function.'
BitDegree's 'Learn PHP Online' Course covers the concepts of variables, functions, and arguments as part of its curriculum on PHP basics, so by the end of the course, that sentence should make perfect sense to you. If you're afraid that could prove difficult, then consider noting down what each jargon word means when you come to them, to be able to review them when an instructor uses a sentence like that later in your PHP education.
The tips in this guide will help to prepare you to be a better PHP student, and ensure a more efficient learning process if followed correctly.
While most of these tips are aimed at those at the start of their quest to learn how to use PHP, some will prove useful for those at a more advanced stage of their PHP education.
But anyway, now that you've put some research into it, you may have made your choice to learn PHP. If that’s the case, there’s only one thing left to do…
It’s time to learn PHP!
It can be a daunting process, as can anything that we choose to learn. But for many, it’s a beautiful road, and there’s a massively rewarding feeling at the end of it. Stick to the tips in this guide and you’ll be well on your way.
If you have any questions for me, please do not hesitate to ask. Simply leave a comment below and I’ll get back to you as soon as possible!