My PHP journery part 1.

So I’ve always wanted to learn php.  It’s a type of server side scripting language which is used to create dynamic websites.  It was created by a chap called Rasmus Lerdorf, who even though his name sounds like a Bond villain, actually changed the world in ways you can’t imagine – and for the better.  He created the  php scripting language and when her first built it, he called it “personal home page” but it soon changed to something sounding a lot more complicated which was “Hypertext Preprocessor”.  In 1995 it was very foresighted and still is.

The official home of php is php.net.  There you’ll find everything you need to know about how it works, what symbols mean, how to use those symbols and what you can do with php.  What can you do with php? Anything – is the answer.  One thing you have to remember with php is, it’s a language – practice, practice, practice!  Otherwise, you’ll learn something and forget it the next day.

I’ve started a php web programming short course for beginners at City University London on a Tuesday night. At the time of writing this I am in my second week.  Already, I think my head is about to explode, but I’ve realised what a fundamental thing php knowledge is in this day an age.  It’s as fundamental as knowing how to create fire if you’re working in the tech or media industry.

And a big round of applause for my genius employers for  funding this fundamental character development!

What you need for writing php

A decent text editor, notepade++ all the way…
A localhost server (such as xampp), or a server to upload and test your php scripts.

Basic stuff to remember with php programming

When you’re writing a php script it starts with “<?php“.
When you write something, to end the phrase in that script, end it with “;
Whole scripts end with “?>

Script means code, this is different from a string, which I’ll get too.

Echo” means get or run whatever it is you’ve created.

Variables

A variable is like a box, you name the box and you give it a value, so that when you open/echo/run the box, it’ll show what it is you want, variables also start with “$” – so for example $animal = ‘kitten’;   (Like most things, they won’t do anything unless you pay them I guess)

‘animal’ is the name, ‘kitten’ is the value.

You can have different data types (what’s in the box/variable)
1. Integers – which are simple whole numbers
2. Floats – which numbers with decimal points
3. Strings – words, which are displayed in single quote marks
4. Boolean – data types which carry a TRUE or FALSE value, TRUE or FALSE will determine whether something works or not (Excuse the simpleton explanations, this is just how I understand it so far…)

So, if you’re writing code and you want to show a variable it would look like:

<?php

$animal1 = ‘dog’;
$animal2 = ‘cat’;

echo $animal1 . $animal2;

?> 

When you upload this script to a server or a localhost then you will see “dogcat” on a blank screen.  And that is the result of using a couple of variables.  You’ll notice in the code above that there is a dot, think of the dot as a piece of glue, adding the two together, but not mathematically adding it, instead literally putting one next to the other.

php comments 

If you’re writing a piece a code and you want to make a note of something then you can add a comment. Comments start and end with // or ##.  

Operators

Operators are pieces of code which make your data/variables do something.  So adding, taking away, displaying what is or isn’t equal.

The basic ones are:

Plus + Divide Multiply Minus  Modulo % 

The above all look pretty self explanatory… Modulo, is the sore thumb.  Modulo is the remainder of a divide equation.  For example – 3 divided by 7 is 2, and you have 1 as the remainder. 1 is the modulo. If something divides perfectly, then 0 is the modulo.  0 is FALSE in php code… We’ll get to this – but remember it for now.

Increment and decrement

This is adding and taking away, increase and decrease.  ++ means add 1, means take away 1.

Where you put them in the code depends on the answer.  If you want the increase or decrease to happen then put them first.

For example:

$x = 10 
$y = ++$x 
$y = 11

If you don’t want to work then put them after…

$x = 10 
$y = $x++ 
$y = 10 

$y is still 10. That’s the just the way it goes folks.

Equations which are in brackets are carried out first. Remember that too! Remember BODMAS at  school? The order of operation? Well, Google it, and know that the same applies to php when running your scripts.

There are logical operators but we’ll get to those very soon! So… is your brain hurting yet?

This is what happens when you put Hollywood actresses through an SVG converter

Ever wondered what a Hollywood starlet would look like if you were to run them through and SVG converter? I know what you’re thinking… what is an SVG converter. SVG is short for ‘Scalable Vector Graphic’ which is a graphic used for 2D images. They can be lots of different things and there’s a lot of history about SVG’s ,which you can read up on here. (Although no one will blame you if you don’t bother!)

Anne Hathaway

141856d1388143144_anne_hathaway_anne_hathaway_phot

Amber Heard

amber_heard_6853_2560x1600

Angelina Jolie

Angelina_Jolie_

Catherine Zeta Jones

catherine_zeta_jones_wallpaper_picture

Mila Kunis

GEMFIELDS_Mila_Kunis_2013_Campaign

Gwyneth Paltrow

Gwyneth_Paltrow_768x1366

Jennifer Aniston

jennifer_aniston_birthday_pic

Jessica Alba

jessica4

Keira Knightly

Keira_Knightley_Wallpaper