If you are building a website that you want to feature web 2.0 elements and a community feel, then it is important to familiarize yourself with PHP. PHP is a programming language and this is what is used to build the more dynamic and interactive elements of a website. If a site allows you to make and edit profiles, to upload pictures and media files, or to post messages – then PHP is at play.
You might not need to programme your page yourself, and you may rather leave that in the capable hands of a web development team. Either way however, if you are going to involve this kind of code then you should make sure that you at least have a basic understanding of it so that you can discuss it with your team and so that you can find your way around it to edit it when you need to make changes.
Note however that this is NOT a full guide to programming in PHP and you’re not going to finish this article able to make the next Facebook – it would take several books as thick as wedges to accomplish that. Rather then, this is just a beginners’ introduction to what PHP is and a little bit about its strengths and limitations.
An Introduction to PHP
The letters in PHP interestingly are what are known as a ‘recursive acronym’. This is because they stand for ‘PHP Hypertext Processor’, meaning that there is something of an infinite paradox at play here.
That really isn’t important however. More importantly you might hear people describe PHP as a ‘server side’ script. Understanding what is meant by ‘server side’ is an important way to start to learn the strengths and limitations of the language.
Basically by ‘server-side’ is meant that the code is read and performed by the server itself, rather than the computer that visits it. So when you visit a PHP site, the server that controls the files will run the code and then it will show only the output. This means that the code is handled only when the page is loaded and to work with an input you’d have to reload the page or load a new one. At the same time it means that the output will look identical regardless of what device it is viewed on making this a highly compatible way to code.
Lastly, and perhaps most importantly, being server-side means that the code has access to all the files stored on that server. This means that it’s the language you want to use when you upload a new file, or when you edit an existing one – and that’s what makes it ideally suited for running social networks or forums.
Recognizing and Understanding PHP
There is the basic idea behind PHP, but what does it actually look like? Well fortunately PHP is easy to recognize due to its distinctive formatting rules. PHP for instance is normally written in lower case, and all lines of code will end with a semi colon (unless they are inside brackets). Other indicators are the ‘’ opening and closing tabs in HTML which indicate it’s PHP. The majority of PHP files will use the .php extension, but it can also be integrated into .html files.
When you’re trying to edit sites that use PHP you will probably want to leave the actual code alone. Instead look for the command ‘echo’ which will be followed by quotation marks. This is the equivalent of ‘PRINT’ for anyone who remember BASIC programming and anything that follows will get displayed on the screen. You can tamper with the text and HTML within these quotation marks and it won’t ruin your page.