Do you know which script WordPress is written in?
OK, I know you know that. It is PHP.
So, if you are thinking about becoming a WordPress Developer, you have to learn PHP well.
What Is PHP And How It Works
PHP is a server side HTML embedded scripting language.
Ah, boring definition, isn’t it?
Why don’t we make it some fun?
For that, we will have to go a bit deep into how internet functions. I won’t go in much detail however (because that way, you will get to read something like “when you press the “Enter” key on your keyboard, a 1.5 V signal flows through it’s 2 Ohm resistant circuit and then enters the connecting post which has 7 pins”)
Disclaimer: I do not know what I just typed. I am not an electronics student! I had electronics as subject in first year of college and I scored lowest in it!
OK, going back to internet now.
So, when you type a website’s address in your address bar and press “Go” or Enter, this address is converted to an IP address. Once this is done, the server to which the IP address belongs is contacted.
Mr. Server now takes a look on his hard disk for the requested page. Once the page is found, it determines which type of page it is. If page belongs to HTML family, Mr. Server sends the page to requesting computer (your computer) and on your computer, your web browser ( Mr. Chrome The 12.0.742.112th in My Case ) displays the page.
Now, what if the page in place is a PHP page?
Then some different thing happens. The PHP page is not very different from the HTML page but it has some strange tags in it. These tags tell the web server to do pass them through PHP Intrepreter which does some magic on them and produces a normal page. Yes, magically, every PHP tag is removed and at it’s place, some HTML is filled!
OK, the process is not magical. But for now, let it be! I have been too technical for today.
So, the thing is that, PHP is server side. All the code is on server side and is never sent to client as it is. Server does its magic and then sends the code further.
How Is PHP Important
PHP is quite important. First thing, since you want to be a WordPress Developer, you have to learn it anyway.
Second, it is not about WordPress only. There are lot of Content Management Systems written in PHP and it is also used widely on internet as it is free, cross platform and is easy to learn.
Let’s Start Learning PHP
OK, enough of PHP is this, PHP is that and PHP is Important because thing…… Let’s get down and dirty with the actual thing.
So, everything in PHP has to be inside PHP Tags. And what in the world is this PHP tag? Here are examples:
<?php ?>
<? ?>
These two types are most common and are available on every PHP server. There are two other types that can be enabled using PHP settings.
PHP’s syntax closely resembles C and if you have learned that, you are going to find things familiar.
Let’s have a look at Hello World for PHP:
<html><head><title>My First PHP Page</title></head>
<body>
<?php print ‘Hello World’ ; ?>
</body></html>
Simple, isn’t it? Yes, most of the document is HTML only. The <?php print ‘Hello World’ ; ?> line prints out “Hello World” and that’s it.
This is just a simple example. Stay tuned for further examples as we have a lot of PHP and then WordPress to learn.
If you liked this post, do not forget to subscribe.





2 Comments on "WordPress Development: PHP Basics"
I really like the way u explain here.
good explanation