What is PHP?
You hear all those articles about how good PHP is, and how it’s the best Web development kit you’ll ever need, which of course is true but you may not even know what it is about and how it is used.
For starters, let’s just compare what you can do with HTML and PHP with HTML, you can make static Web pages that are not interactive to the visitor and with PHP, you can make dynamic Web pages that are interactive to the visitor. Remember, you’ll always need HTML in your PHP development, as HTML, as we know, structures (and possibly styles, in some cases) our Web pages. Luckily enough PHP is an HTML embedded scripting language, so, unlike other scripting languages, HTML can be embedded inside PHP files (or, in other terms, the PHP code).
I must stress PHP is not anything to do with HTML, and isn’t used to build Web pages like HTML can do, however it is used to build dynamic Web pages. Okay, let’s make an example:
- You build the online form using HTML
- You set it to your e-mail address
- You save the file
Okay, fair enough, what’s the big deal then? This isn’t dynamic as when a visitor visits the Web page, upon clicking the button to submit the form, their favourite e-mail program will open up with the e-mail contents, and they’ll have to manually submit the e-mail themselves.
However, with PHP, that’s a little different. Using the HTML form as normal, we submit the form data to a different page on your Website and some PHP pre-defined variables as we call them POST or GET hold the form data and then sends the contents of those pre-defined variables to your e-mail inbox, without the visitor having to do a thing! Now, that is a dynamic Web page, as it’s interactive to the visitor.
Now, if you think about it if PHP can do that, it can do a lot of other things too! Well, you’re absolutely right! PHP could display the form data they submitted on the second page (where the form data is e-mailed to you), by simply (as us programmers call it) echoing the contents of the variables to the Web page, using the echo function.
What are functions?
The best thing about PHP is it is quicker to setup a dynamic Web page than other scripting languages. Why, you ask? Simply because of the wide use of functions PHP have. Unlike other scripting languages, PHP has functions for almost anything you can think of, including to prevent exploitations in your code, to check string lengths (for submitted forms, for instance), to check particular variables values are integers, and so much more. Whenever you want to look up a function in PHP, usually just typing it in on Google will get you the results you need, but go to the official PHP Website (which is www.php.net) where you’ll find tutorials on every single function. You can also find the PHP manual there (which is incredibly step by step and easy to understand).
Hmm, I’m not really sure, I mean, all this fish talk seems a bit too complicated!
If you haven’t noticed already, PHP is the most widely supported language on the Web, and you’ll find hundreds, upon thousands of resources over the Internet as well as community forums devoted to PHP, which I am sure would be able to help you on your PHP footpath. There are also PHP mailing lists at PHP.net, which you can signup to, absolutely free, for whenever you need help. And, not to mention, eUKhost.com community forums, we are here to help if you have any PHP specific problems or questions, we have quite a few PHP competent members on our forum which would be happy to help you, join in at www.eukhost.com/forums
I hope you enjoyed this article and found out why PHP is such a good language, and what it is about. There are so many resources over the Web related to PHP you’ll never become lost; Google.com is the only thing you’ll need to find the resources you need ;). Good luck!