- slide 1 of 5
What is PHP? PHP is a recursive acronym stands for PHP Hypertext Preprocessor. In your hours spent trawling the Internet you have probably come across PHP numerous times. You may not know how powerful the language is, and what it can do and you may not have even seen any PHP code before now! PHP has the awesome position of being the only open-source server-side scripting language that's both powerful and satisfying to learn!
- slide 2 of 5
Why Use PHP?
HTML is completely static. By using and HTML, we can create dynamic sites that will change depending on certain conditions. Not to mention that PHP is powerful, scalable and best of all, free. Data-driven applications can be mashed up quickly with the built-in database support in PHP, add an excellent manual, a friendly community and a price of zero - and you've got my favourite programming language!
- slide 3 of 5
Setting Up Your Environment
As with all programming languages, before you begin to staring programming PHP, you need to have a development environment set up on your box. In the following PHP tutorial we will be using PHP with the Apache Web server running on Linux. However, you can just as easily use PHP with Apache on any operating system. Detailed instructions on how to set up a LAMP (Linux, Apache, MySQL, PHP) development environment on are here, in another of my articles.
- slide 4 of 5
Learning Some Syntax
PHP code sits inside a page with the HTML, as with HTML it is made up of plain-text. Therefore, a page that shows "We are about to learn some awesome PHP skillz (yes, skills with a z)" would be inside an HTML page named filename.php like this:
<title>Bright Hub Article</title>
<body> <p>That is some simple PHP code below:</p>
echo 'Hi, my name is Josef';
See? The HTML is rendered as HTML and the code between the <?php and ?> gets executed as PHP.
You may notice some instances where the "php" after the question mark is missing. This is a lazy practice known as "PHP short tags" - full tags should always be used! Also, PHP statements end in a semi-colon, however, a semi-colon is not required to terminate the last line of a PHP block, as the PHP closing tag ?> contains a semi-colon.
- slide 5 of 5
I hope you enjoyed this brief introduction to PHP and that you come back for part two! In the next article we will take a look at more statements, how to comment and execute your beautiful PHP code!
A Guide to Linux Programming with PHP
- A Guide to Linux Programming with PHP
- A Guide to Linux Programming with PHP - Commenting and Executing Code
- A Guide to Linux Programming with PHP - Variables & Data Types
- A Guide to Linux Programming with PHP - HTML Forms and PHP
- A Guide to Linux Programming with PHP - Arrays
- A Guide to Linux Programming with PHP - Associative and Multidimensional Arrays