PHP Basic
2010-10-05 @ 23:23:02
Hi! This is my blog where I will add tutorial about making website.
First part is about basic of PHP. So let's begin :)
PHP Introduction
Before we write some easy script you should know what is it PHP.
Sometimes when you get to some site you can see in link for example index.php .
This php in the end is file extension, which tells us that this is a php file. PHP file can contain text, HTML tags and scripts.
But in general PHP is a server-side scripting language. PHP also supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.).
Ok, enough of this teory.
What will you need?
There is two options:
- first:
localserver for example WebServ 2.0 or Krasnal
- second:
web hosting. It could be free server.
Why we need server? As I wrote, PHP is server-side scripting language. This means that server processes our code.
And you also should have a basic understanding of HTML.
Of course last thing is editor :) I use notepad++ or keD2.
First code
When you want use PHP you have to starts with <?php and ends with ?>.
You can put it anywhere in the document.
For example:
<html>
<body>
<?php
echo "Hello World!";
?>
</body>
</html>
<body>
<?php
echo "Hello World!";
?>
</body>
</html>
This is PHP's code in HTML tags.
This simple code sends the text "Hello World!" to the browser.
We use echo or print to output text. We put our text to display in quotation marks and each line in PHP must end with semicolon.
And today it is all. In next post I will write about comments and variables in PHP.
Bye