QUOTE
First off, we need to meet each other. I am Archimedes! xD I chose this name because I have a joy for mathematics and calculators and such. Archimedes is the man who discovered Pi(3.14159).
Things you should know before we start Lesson #1.
1.HTML
2.General scripting knowledge or what it actually does.
Alright, to the PHP lessons.
1.PHP stands for PHP; Hypertext Preprocessor.
2.PHP is used all around the world to build dynamic web pages and web sites.
Basic Syntax
1. All PHP scripts start with the<?php or <? tag. I'd use the <?php tag just to be a little bit more tidy, just my opinion though.
2. To write something in PHP, we use the 'echo' or 'print' statement, like so.
Output: Hello Astahost!
3. All PHP statements end with a semicolon(
.(In italics in the first code snippet.)
Comments
4. To type comments in PHP we use // for one line comments or /* */ to make a comment block, like in this example. Comments DO NOT end with a semicolon.
Output: Hello Astahost!
Variables
5. At school, you use variables to substitute for numbers. Like, 4f + f = d. f=2, therefore 4*2+2=10. d=10.
6. In PHP, variables are 'saved' with the USD sign($).
Output: Hello
8. To type 2 variables after each other, you'd separate them with '. " " .', like so.
Output: Hello 4
Operators
Operator - Name - Ex. - Output
+ - Addition - x=2. 4 + x - 6
- - Subtraction - x=2. 4 - x - 2
* - Multiplication - x=2. 4 * x - 8
/ - Division - x=2. 4 / x - 2
For a list of all operators, click here.
That's it for our first lesson, see ya soon!
The Human Calculator,
Archimedes
Things you should know before we start Lesson #1.
1.HTML
2.General scripting knowledge or what it actually does.
Alright, to the PHP lessons.
1.PHP stands for PHP; Hypertext Preprocessor.
2.PHP is used all around the world to build dynamic web pages and web sites.
Basic Syntax
1. All PHP scripts start with the<?php or <? tag. I'd use the <?php tag just to be a little bit more tidy, just my opinion though.
2. To write something in PHP, we use the 'echo' or 'print' statement, like so.
CODE
<?php
echo "Hello Astahost!";
?>
echo "Hello Astahost!";
?>
Output: Hello Astahost!
3. All PHP statements end with a semicolon(
Comments
4. To type comments in PHP we use // for one line comments or /* */ to make a comment block, like in this example. Comments DO NOT end with a semicolon.
CODE
<?php
//This is a one lined comment(has no effect on the script, whatsoever)
echo "Hello Astahost!";
/*
This
is a
Comment block(has no effect on the script, whatsoever)
*/
?>
//This is a one lined comment(has no effect on the script, whatsoever)
echo "Hello Astahost!";
/*
This
is a
Comment block(has no effect on the script, whatsoever)
*/
?>
Output: Hello Astahost!
Variables
5. At school, you use variables to substitute for numbers. Like, 4f + f = d. f=2, therefore 4*2+2=10. d=10.
6. In PHP, variables are 'saved' with the USD sign($).
CODE
<?php
$text = "Hello";
$number = 4;
echo $text;
?>
$text = "Hello";
$number = 4;
echo $text;
?>
Output: Hello
8. To type 2 variables after each other, you'd separate them with '. " " .', like so.
CODE
<?php
$text = "Hello";
$number = 4;
echo $text . " " . $number;
?>
$text = "Hello";
$number = 4;
echo $text . " " . $number;
?>
Output: Hello 4
Operators
Operator - Name - Ex. - Output
+ - Addition - x=2. 4 + x - 6
- - Subtraction - x=2. 4 - x - 2
* - Multiplication - x=2. 4 * x - 8
/ - Division - x=2. 4 / x - 2
For a list of all operators, click here.
That's it for our first lesson, see ya soon!
The Human Calculator,
Archimedes
Notice from Yordan:
copied from w3schools.com under php section pages 1,3,4


