Basic PHP : The Full Language Introduction 1

Thobela Kgoshi ...

Please note that this tutorial is part of the Build Your Own Site series of tutorials. Feel free to restart the series.

"Alright, alright, alright ..." - Matthew McConaughey ...

Let's get into it Partner.

In the last tutorial of the series; 'Build Your Own Site', we elaborated a lot more on HTML, and helped built our first Form on an HTML Page. We talked a little about submitting forms and needing PHP to process that form submission. And so here we are; learning some of that PHP "good-good" to get you start.

"Alright, alright, alright ..." - Kevin Hart's Dad

Now that we have talked extensively about how all of this is going to work, let's get back to the topic at hand shall we; learning how to use the PHP language.

PHP Tags

As we've indicated in a lot of our previous tutorials, PHP is written between php tags, like so:

<?php  exit('soul train'); //php here  ?>
<title>PHP FOOL!!</title>

    php above fool

    echo 'hello world';

Variables in PHP are declared with the $ sign, because we're all about that moolla booiiyyy. Naaahh it's just a convention that was adapted at the creation of the language. Look at the example below

    $stuff = "Hello World";
    echo stuff;
    $stuff = "Hello World";
    echo $stuff;

    $stuff = "New value";
    echo $stuff;
    $stuff = "Hello World";
    echo "At first you have to say ".$stuff;

    $num = 5;

    $sum = $num + 5; // this will give 10

    $difference = $num - 2; // this will give 3

    $multiplication = $num * 2; // this will give 10

    $division = $num / 1; // this will give you 5


We'll be using a lot of PHP variables in these tutorials, so please look at these basic PHP variable rules below.

Rules for PHP variables:

"We'll be using a lot of PHP variables in these tutorials, so please look at these basic PHP variable rules."

The Village Geek

"Alright, alright, alright ..." - Matthew McConaughey

We've learnt enough for one tutorial Betsy, go ahead and get some lemonade and a biscuit, and maybe take a long walk to the park will ya :)

In the next tutorial we'll continue in our quest to get you more familiar with the basics of PHP.

Cape Town, South Africa

Comments  (0)


Reply to this discussion

You cannot make comments, please login:

Login or Register

Coming Soon ...