Skip to content

Commit c232788

Browse files
author
dima_los
committed
Added Tutorial 4 source code
1 parent 982f93b commit c232788

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

tutorial-4-variables-part-1/.htaccess

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
php_value display_errors On
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$counter = 1;
4+
$counter = $counter + 1;
5+
//now counter holds 2
6+
$counter = $counter + 1;
7+
//now counter holds 3
8+
//and so on.

tutorial-4-variables-part-1/play.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
$favoriteSuperHero = 'Spider man';
4+
$age = 16;
5+
6+
echo $favoriteSuperHero; //shows 'Spider man' in your browser
7+
echo $age;//shows 16 in your browser
8+
9+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
$favoriteSuperHero = 'Spider man';
4+
5+
echo $favoriteSuperHero;
6+
echo $favoriteSuperHero;
7+
echo $favoriteSuperHero;
8+
echo $favoriteSuperHero;
9+
echo $favoriteSuperHero;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
echo 'Spider man';
4+
echo 'Spider man';
5+
echo 'Spider man';
6+
echo 'Spider man';
7+
echo 'Spider man';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
//valid variable names
4+
$email = '[email protected]';//starting with a lowercase letter
5+
$Email = '[email protected]';//starting with an uppercase letter
6+
$_avangers = false;//starting with an underscore
7+
$a51desert = true;//digits are allowed from the second character
8+
$area51 = true;
9+
$fullName = 'Spider Man'; //mixing lowercase and uppercase characters
10+
$n_e_e_d____F_o_R___speed_2 = 'Underground';//mixing underscores, lowercase, uppercase and digits
11+
12+
/*
13+
//invalid variable names
14+
email = '[email protected]';//a variable must begin with $
15+
$4diablo = 'IsAwesome'; //starting variable with a digit
16+
$diablo-four = 'Sucks'; //using the special character '-' in the variable name
17+
$bg!3 = 'Amazing'; //using the special character '!' in the variable name
18+
$^water_melon = false; //using the special character '^' in the variable name
19+
$name@of_our_galaxy = 'Milky Way Galaxy'; //using the special character '@' in the variable name
20+
$%*__of__() = false; //using special characters '%*()' in the variable name
21+
*/

0 commit comments

Comments
 (0)