PHP Tutorial 2 – Basic syntax

Hello this is tutorial #2!

This tutorial will teach you basic PHP syntax. Any PHP scripting block always starts with <?php and ends with ?>, although some server configurations allow <? for a starting tag, I recommend always using <?php as a starting tag for maximum compatibility. So we always start and end like this:

<?php
//some code here...
?>

In my code fragment above you might have noticed ‘//some code above‘ The two forward slashes mean a comment is following. This kind of comment is called a single-line comment and is terminated when you insert a newline character.
For multi-line-comment use this construction:

<?php
/* Multi Line Comment started...
You can continue on this line...
and even on this line...
But after the multi line comment stop, things you type will be interpreted as code again
*/
echo "This is a little bit of code that will be executed";
// echo "This line wont be executed because it's commented!";
// So after the */ you can type code again
?>

So now that you know basic php syntax for starting and ending a php scripting block, I will finally introduce you to using variables! Continue reading PHP Tutorial 2 – Basic syntax

PHP Tutorial 1 – Getting started with PHP using WampServer2 on Windows 7

Hello all,

Here is the first of tutorials that I will make to cover the basics of PHP. My goal is not to have yet another tutorial-blog/site, but to show how I got started with PHP and eventually show some advanced things you can do with it. To reach that goal, I first want to introduce ‘newbies’ to PHP. In this tutorial I’m going to assume you have basic knowledge of HTML, which will be used sometimes in examples. If you don’t know HTML, I recommend visiting w3schools.com

What is PHP?

PHP is a scripting language which is used among others for creating dynamic web pages.

What does PHP stand for?

PHP stands for: Hypertext Preprocessor. You might ask me what the first P stands for… well, back in the days PHP used to mean: Personal Home Page, but then they wanted something more sophisticated and changed it a little while keeping the first P.

What can you do with it?

There infinitely many things you could do with PHP, but it comes down to this list of general subjects:

  • create dynamic web page
  • create web application
    • PhpMyAdmin (database management system)
  • create a CMS(content management system)
    • WordPress
    • Drupal
    • Joomla
  • create <script_name_here>

Continue reading PHP Tutorial 1 – Getting started with PHP using WampServer2 on Windows 7