PLEASE HELP , please explain this in PHP!!! Thanks :)?

  • Thread starter Thread starter Marikoula
  • Start date Start date
M

Marikoula

Guest
Hi, can you please explain this to me. Iam learning php and I'm really confused as to why all the numbers and counting?

Here is what the tutorial says:


__________________________________________________________

Some more examples

$test variable = 1 + 1; // Assigns a value of 2.
$testvariable = 1 – 1; // Assigns a value of 0.
$testvariable = 2 * 2; // Assigns a value of 4.
$testvariable = 2 / 2; // Assigns a value of 1.

Okay to make things easier I will show you an example here we will create a variables $a, $b and multiply them and store the value in $c, just see it's so simple.


<?php
$a = 5; //we created a variable a and assigned it a value of 5
$b = 2; //we created a variable b and assigned it a value of 2

$c = $a * $b; //we multiplied the Variable a and b then stored the value in c
echo $c; //we print the content of variable c which is 10


WHAT does this mean, can you explain it easy for me to understand, please?

Thanks so much, I appreciate all Your help :)
 
First you know that in programing numbers are assigned into some other variable (or) data type

That 1+1=2 so they store the value 2 in $test variable
Then 1-1=0 so they store the value 0 in $test variable
Then 2*2=4 so they store the value 4 in $test variable
Then 2/2=1 so they store the value 1 in $test variable

Here they showing you. You can store directly 2(or) 1+1 both are same you can do like this also

$test variable0 = 1 + 1;
$test variable1 = 1 + $test variable0;
Then the value $test variable0=2 And $test variable1=2+1=3

You dont declare only $test variable0 .. you can give any word like $a and $b also anything like this..

you Know Algebra
a=2
b=2
c=a*b;

like this only

They Sto
storing 5 value in$a
and 2 value in$b

Then they Multiplying Both $a and $b
$c=$a*$b;
so
$c=5*2;
Then Answer of $c is 10 <.0..0.>
 
Back
Top