on air

Variables | PHP Basics.

back home » Scripting Tutorials » PHP » Variables | PHP Basics.


What Is A Variable.

A variable is used to produce another value. Putting it in a casual form, a variable is like an alias name. They can be defined as a string or a numeric value.

Type Of Variables.

In PHP, a variable always starts with a dollar sign [$], followed by an equal sign [=] and then,

  • A chosen word placed inside quotations ["String"].
  • A number without quotations [10].
  • As addition [5+10]

and all ending with a semicolon [; ].

See Illustration below.

<?php
$a = "Test";
print $a;
//This will print a string value [Test] using the variable $a

$num = 10; print $num; //This will print a Number value [10] using the variable $num $add = 5+10; print $add; //This will print an equal value of [15] or [5+10] using the variable $add ?>

Combining Variables' Values.

Values can also be combined using a period [.] this will reproduce another value.

Variables can also be used as values for a new variable.

See Illustration below.

<?php 
$a = 3;
$b = 2;
$c = $a.$b;
//Now the variable $c sets its value to [32] using the values of $a and $b

$d = $c + 10 ;
echo $d;
/*$d will echo a value of [42], because its vaule $c already 
has a value of [32] plus [10], bringing its new value to [42]
*/

$e = "Years";
$f = $d.$e;
echo $f;
//$f will echo a value of [42Years], blending numeric and string values.
?>

As you can see variables can be twisted and crushed into so many directions. Just look forward to some more variable examples. coming soon.

Variables | PHP.

Clicks4UrMind

Man will give you worldly powers, and make you feel on top of all, note this is temporally and could be redrawn at anytime sending you back to the ground floor of life. However, the Lord Almighty, the one and the only rightful ruler of the Universe, blesses everlastingly.

Brain

Knowledge is Power, but Power is not Knowledge. Wisdom is the truthful Power that identifies the Knowledge within the man. And only, I repeat 3x. Only the almighty God has the power to bless the man with his Wisdom forever.

To achieve the Lord's blessings, cease not praying daily, asking for his Wisdom, and you'll be blessed abundantly...

SPYERA PHONE

Spyera Phone

Spyera Phone version is software that you install on a smart phone to monitor everything happening on the phone. After installation, SPYERA secretly records events (sms, call history, phone book, location, emails, What's App messages, IM, Facebook Chat, Skype, See photos taken and many more...) that happen on the phone and delivers these information to a web account, where you can view these reports 24/7 from any Internet enabled computer or mobile phone. SPYERA also allows you to listen to the surroundings of the target mobile , listen to the phone conversation and to know the location of the device.

 

Please, Kindly Donate What You Can, Enabling Us Pay Hosting And Domain Costing, And Do More.

Please Donate