Why are people still learning PHP

10 tips for learning PHP

0

Before you start learning PHP, take a moment to plan your approach to learning this programming language.

Professional developers who have learned PHP have already spent a large number of hours mastering this skill. To emulate them, you need to make sure that you are highly motivated and, most importantly, willing to invest a lot of time so that you learn PHP quickly and efficiently. The slower and more inefficient your learning methods, the longer it will take you to get a job in PHP development or to create the application you want.

What is worse about slow and inefficient learning is that there is a high probability that you will give up on your endeavor altogether. Research from Harvard University and MIT has found that only 4% of students who sign up for online courses complete them.

So how can you help the other 96% of people code?

I have one here List of 10 tips put together for learning PHP. The tips are designed to help you learn efficiently, stay motivated, and avoid potential difficulties from the start.

Let's start right away!

1. Make sure you want to learn PHP

If you came across this article as a novice programming user, you probably don't have any preferences as to which programming language you want to learn. This isn't necessarily a problem, but it can create a problem later when you find that a different programming language suits your goals much better.

PHP is a server-side programming language that is widely used in web development. If you find in the next few months that you would rather work at Rockstar and help build the next version of Grand Theft Auto, it would have been better to learn C or C ++. These languages ​​are used much more often in game development.

However, there are many good reasons for PHP:

  • You want to take your WordPress knowledge to the next level. As of September 2018, 7% of all websites use WordPress. Since WordPress is powered by PHP, there is an enormous demand for PHP developers. If you want to use other content management systems like Joomla or Drupal, you have to know that these were also created with PHP.
  • Compared to other programming languages, PHP is considered to be relatively easy to learn.
  • Because PHP is native to the web, you can get simple projects online much faster and with less difficulty. For you, this means that you will see the results of your efforts much faster than if you were to learn another language.

So before you start learning PHP, make sure it suits your needs and future projects.

2. Keep an eye on your projects

Now that you are sure that you want to learn PHP, it is very useful to have a goal as well. Learning PHP will be a long process that is easier as long as you are motivated because you have an end goal in mind. Online courses like the “Learn PHP” course from LerneProgrammieren keep the learning process interesting and interactive as you create a project while learning the basics of PHP development. This is a good way to make the learning process interesting and understandable.

But it's even better if you keep an eye on your own project. This gives you more incentive to remember what you have learned if you want to apply it to your project.

You have to practice your newly developed PHP skills continuously. This is usually easier with your own project. You can also create different versions of your project as your skills improve. For example, you could create a simple contacts app that has basic functionality for adding and deleting contacts. When you have learned more skills, you can connect the app to a database. You can add advanced features later before going live with the app and inviting your friends to fill in their details.

Before you know it, you could already be the owner of one of the world's largest social networking websites, connecting more than a billion people and generating billions in advertising revenue - who knows?

3. Learn HTML first

While PHP is a great choice as your first programming language, it shouldn't be your first step into web development. If you can't already, devote some time to HTML before starting PHP.

HTML is more of a markup language. markup language) as a programming language and forms the basis for websites. This means that the code you write represents the basic elements of a website, e.g. images or text. You cannot program functions with a markup language, which makes learning relatively easy. In order to make websites more dynamic, a language like PHP must be used in addition to HTML.

Since PHP is generally used to make HTML more dynamic, HTML is often built into PHP documents. However, HTML is not only present in most PHP applications, it is also part of many tutorials and lessons in learning PHP. However, some of these tutorials require that you already have some knowledge of HTML.

Instead of doing both at once, take a few hours to learn the basics of HTML first. Learning PHP will take months, but HTML really only takes a few hours to understand and use.
Get started with our LearnProgramming HTML course to shorten your learning time.

4. Active learning is better than passive learning

One of the best ways to make your learning more effective is to learn actively rather than passively. Passive learning means that you simply take in the information by looking, reading or listening to it. Active learning means that you apply what you learn directly in a project.

Educators agree that active learning strategies are better than passive ones. The only problem is that creating an active learning experience is usually more difficult.

The Learn Programming PHP course is a great example of an active learning experience. In order to complete each lesson in the course, you will need to solve a problem using the resources you have previously learned.

An example of a passive learning experience would be watching a YouTube video with a teacher speaking to a presentation and explaining features to you. Such passive learning experiences can still be very useful. Maybe your YouTube teacher offers you the best explanation you've ever heard.

So my advice is not that you should avoid passive learning entirely, but rather that you should do it actively. You can write down the examples of a lecture or a video yourself, make changes to the code and see what happens.

5. Don't be afraid to disassemble the code

Be careful with this advice. If you're working on a live website, deliberately breaking down the PHP code is certainly not the best idea. If you work with WordPress, it is generally recommended to leave the PHP files in the WordPress core alone. Leave these files as they are.

In offline project files that you create yourself or in PHP files in the WordPress theme folders, however, it is not a bad idea to break down the code. You will learn a great deal by putting them back together.

So my advice doesn't mean that you should dismantle your own website, it just means that you don't have to be afraid if that happens. When something goes wrong, it is generally a great learning experience. The bigger the problem, the better you'll remember the solution.

For beginners, the interactive code editors in the LerneProgrammieren PHP course are an ideal development environment for experimenting. You can be sure that whatever you're doing, you won't crash the whole LearnProgramming website. 😉 So try it out!

If you have different ideas for solving a problem and the first one works, be sure to try your second idea instead of just moving on. In web development, there are always several ways to solve a problem.

By the way, if the course fee exceeds your current finances, you can also apply for a LerneProgrammierung micro-scholarship. A sponsor can finance your course fees and a small reward awaits you at the end!

6. Enable error logs (error messages) in the PHP.ini

Whenever you break down pieces of code, make sure bug reporting is turned on. It may already be activated by default, but in some cases you will only see a blank screen when you disassemble your PHP application.

In order to display an error report, you have to activate the error handling in your php.ini file with the help of the following code:

ini_set ('display_startup_errors', 1); ini_set ('display_errors', 1); error_reporting (-1);

If you make a mistake in your code, a bug report will return a helpful message to help you debug the problem.

7. The PHP syntax is sensitive

Both in your coding education and in your life as a professional developer, you lose many hours of your life due to syntax errors. A syntax error means that you wrote something that PHP does not understand. This could be because you wrote the name of a variable differently than when you created it, or you forgot to insert a semicolon at the end of your statement. Believe me, you will very often forget these semicolons.

Other programming languages, such as JavaScript, use semicolons a little more liberally than PHP. But PHP can also be quite liberal: in some situations it is considered a best practice not to close PHP tags. In other situations, however, a missing semicolon terminates the entire application. So be careful with your syntax. It is also important that you are case-sensitive.

However, just being aware of and knowing the likelihood of syntax errors is usually helpful. You know where to look first if your program isn't working. Before you delete and restart your entire program, first look for any syntax errors.

8. Write readable code

When you learn to code, you often learn from teachers who have carefully selected their code examples. And if not ... then you should find another teacher.

At first glance, all spaces, indentations, and alignments appear to be superficial. If the code works, then it works, right? Who cares about the distance?

Well If you make a mistake or come back to review the code you wrote some time ago, you will be interested in it. Even worse, if your co-workers have to work with your code, which is totally illegible, you will take a good care of it so that your co-workers don't start hating you.

Well-written code is essential to quickly fixing the errors described in tip 7. If you put all your code on one line, the computer can read it easily. However, if you've forgotten a semicolon, you or someone else will need to find that error.

In what example would it be easier to find a missing semicolon?

<div class="event-oben_tag"> <?php $startTermin = new DateTime(get_field("start_termin")); echo $startTermin->format("M"); ?> </div>

or

<div class="event-oben_tag"><?php $startTermin = new DateTime(get_field("start_termin")); echo $startTermin->format("M"); ?></div>

If it's not obvious: it is the same code. The only difference is the distance.

The first version makes it easier to recognize semicolons at the end of each line, while the HTML span tags and the opening () Of the PHP tags help you with the alignment. Just don't forget to add these tags.

In the second version, all of the code is packed together. Now, instead of just glancing at the end of the line, you need to check all of your code for possible missing semicolons. Where do the PHP tags start and end? In version one they have a specific line, but in the second code you have to scan everything from opening to closing the tags to see if both are there.

In addition to writing your code neatly and legibly, add comments as well. This will help you remember what you were thinking while you were writing. Comments are lines of text that are ignored by the PHP interpreter. You can convert your text into a comment by adding two slashes at the beginning of the line.

// Just like here

The computer completely ignores your comments, making them seem almost pointless. But while the code is for the computer, the comments are for the human. Especially if you are writing something complex, comments for other people or yourself can be extremely useful in the future in understanding what the program is doing.

Here's an example. I wrote this comment on top of my code to remind myself what the command (in line 3) does. The comment is the blue text that starts with //.

Comments are a great way to leave little notes for yourself to remind yourself how to do some things. As a newbie, you will likely reopen the code you are writing now in the future. If someone asks you to create something that you have already created, it may be easier to reference the code because you have already written and understood it. This is always easier than searching for an example on google and trying to understand it.

However, it's only easier if you have your code written clearly and using comments well.

9. Try to solve your problems yourself

Often times, when you run into a problem, the first reaction is to go straight to someone for help. There is nothing wrong with asking for help, many people say it should even be encouraged. However, if you always ask someone when you get stuck, you won't learn nearly as much in one lesson as if you solve the problem yourself. So it always depends on the right time to ask your question.

However, this seems to be more of a problem in a coding boot camp than online. In boot camp, you can just raise your hand to ask your teacher for help.

However, courses like the one on LerneProgrammierung give you the opportunity to send feedback on every lecture in the course and ask your questions so that the instructor can help you with any problems.

Also, always remember: when you learn PHP you are not a forerunner - you are not the first person to learn this programming language. Many people have walked this path before you and their questions are all over the internet. Of course there are also many people who want to help and their answers are all over the internet as well. You just have to find it.

Especially if you are at the very beginning of learning PHP and going through the basics, it is very likely that someone else had your problem before. So if you want to find an answer to your problem with PHP, you have to do what you always do when you have a problem. Google it!

In the first few search results, you will likely find a question similar to yours on Stackoverflow. If you can't find a comparable question, keep in mind that PHP, like any other programming language, has extensive documentation to help users use PHP. The manual can be overwhelming, so there is a more digestible PHP knowledge base available on LerneProgrammierung.

10. Understand technical terms

One difficulty you may encounter early in learning PHP is the technical language used by your teacher or in the instructions. However, a good teacher can explain PHP to you in simple language. However, once you get to the more advanced subjects, your instructor will need to use more technical language to describe concepts of greater complexity.

It is important that you study the words in your new vocabulary as well in order to understand sentences that use two or more slang words. Unfortunately, understanding PHP is almost impossible if you don't understand the concepts behind it and you need the specific language for that. A simple example would be if you understand “how to pass a variable as an argument to a function”.

The LearnProgramming course "PHP Quick Start" covers the concepts of variables, functions and arguments as part of the basics in the PHP learning plan. So, at the end of the course, the sentence should make sense for you. If you think that it is difficult to learn the technical terms, you can always just write down the unfamiliar words and look them up. Later, you can easily check their meaning by looking at where your teacher is using the words.

Conclusion on the PHP tips

My tips can help you prepare yourself to be a better PHP student, and if you follow them correctly, they will also make your learning process more efficient.

While most of the tips are aimed at beginners, advanced PHP learners will also find it here and find some tips and recommendations useful.

By now you have probably done some research and made a decision to learn PHP.If so, there is only one thing left to do ...

Start learning PHP!

Like anything we want to learn, this can be a daunting process at times. However, it is an exciting path and in the end you will be rewarded with an extremely good feeling! Follow my tips and you're on the right track.

If you have any further questions, don't hesitate! You can just leave a comment below and I'll get back to you as soon as possible.