• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Friday, July 20, 2012

OPERATOR IN PHP


Hi… welcome to my site in “We Are Knowledge”. In here you can learn about PHP world.
And now, I want givingyou knowledge PHP about “OPERATOR”.

You know operator of PHP ???

If you do not know, let’s reading my article. In here I want discuss about it.. let’s check it !!

Define from operator is statement for calculation in php include increase, reduction, multiplication, and division. Operator in php very important, because we can too process value.

And I will discuss the operator :
  • Math
  • Assignment
  • Comparison
  • Logic
  • Increment
  • Decrement

MATHEMATICAL OPERATOR

You can copy this coding

Example 1 :

<?php
$increase = 26 + 24;
$decrease = 26 - 24;
$Multipli = 26 * 24;
$devide   = 26 / 24;
$mod      = 26 % 24;
echo "this increase ...: ", $increase."<br>";
echo "this decrease ...: ", $increase."<br>";
echo "this multipli ...: ", $increase."<br>";
echo "this devide .....: ", $increase."<br>";
echo "this mod ........: ", $increase."<br>";
?>


Next paste in your notepad and save as type “PHP”.

For working you must active xampp and click “APACHE”.

Next open your search engine and write “http://localhost/adsanse/3.php”

And this result:

this increase ....: 50
this decrease ...: 50
this multipli .....: 50
this devide .......: 50
this mod ...........: 50



ASSIGMENT OPERATOR

This operator slightly different from mathematical operator. This operator can saving a value. And the valuewe input in “variable”.

Example 2 :

You can copy this coding

<?php
$a = 10;
$b = 20;
$c = 30;
$d = 40;
$e = 50;
echo "$a + $b = ",$a + $b."<br>";
echo "$e - $b = ",$e - $b."<br>";
echo "$a * $d = ",$a * $d."<br>";
echo "$d / $a = ",$d / $a."<br>";
echo "$e % $a = ",$e % $a."<br>";
?>

Next paste in your notepad and save as type “PHP”.

For working you must active xampp and click “APACHE”.

Next open your search engine and write “http://localhost/adsanse/3.php”

And this result:

10 + 20 = 30
50 - 20 = 30
10 * 40 = 400
40 / 10 = 4
50 % 10 = 0


Ok just for it…
I hope ou understand wthis this all…
Thanks was visit in my page…
See you later…

No comments:

Post a Comment