Forbrukslån uten Sikkerhet | Puhelinliittymä vertailu | Kredittkort Test | Strømselskap | Beste Hjemmealarm | Billig Forsikringsselskap | Beste Mobilabonnement | Legge Varmekabler
Php

php Increment or decrements Operator Tutorial

Programming in PHP and impedimenta increment operator is used, usually a gradual increase and decrease of the variable to the default value. There are two types of increment operator; Namely $ a ++ and ++ $ a is the same, and two kinds dikrimenta operator; Namely $ a– and – $ a’s similar. ++ $ A Pre-increment is called (Pre-increment), and $ a ++ operator is called post-increment (Post-increment) operator. Similarly, – $ a is called Pre dikrimenta (Pre-decrement) operator is called, and $ a– Post impedimenta (Post-decrement) operator.

Pre-increment

Suppose $ a = 5; $ B = ++ $ a; The pre-increment (Pre-increment) operator used $ b = ++ $ a; The statement reveals that the first 1 to 5 $ a variable will be added to the 5 + 1 = 6, then assign a variable to $ b or will be received. Now, if $ a and $ b of the echo is displayed in a browser, it will appear both in the browser 6.

Post-increment

Suppose $ a = 5; $ B = $ a ++; The post-increment (Post-increment) operator used $ b = $ a ++; The statement reveals that the old value of the variable $ a 5 $ b = $ a ++; Statement to be used, that is, the first to be received or assign a variable to $ b $ a variable 5, and then the old value of 1 to 5 will be added to the 5 + 1 = 6. Now, if $ a and $ b of the echo is displayed in a browser, the browser will appear 6 $ a and $ b variables and variable 5 will be displayed.

Pre-decrement

Suppose $ a = 5; $ B = – $ a; The Pre impedimenta (Pre-decrement) operator used $ b = – $ a; The statement reveals that the first minus 1 to 5 $ a variable would be 5-1 = 4, then it will be received, or will assign a variable to $ b. Now, if $ a and $ b of the echo is displayed in a browser, it will appear in both the browser 4.

Post-decrement

Suppose $ a = 5; $ B = $ a–; The post impedimenta (Post-decrement) operator used $ b = $ a–; The statement reveals that the old value of the variable $ a 5 $ b = $ a–; Statement to be used, that is, the first to be received or assign a variable to $ b 5 and then subtract 1 to 5 $ a variable will be the old standard will be 5-1 = 4. Now, if $ a and $ b of the echo is displayed in a browser, the browser will be $ a and $ b variable variable 4 to 5 will be displayed.

Practice Project

<html>
<head>
<title> www.trickbd.com.bd</title>
<style>
body{background: #00cc99 ; color: #000000;}
h2{color: #663300;}
h1{color: #CC00CC;}
</style>

</head>
<body>
<?php
echo “<h2>Pre Increment </h2>”;
$a=5;
echo “A = “. $a;
echo “<br />”;
$b=++$a;
echo “For Pre Increment B = “. $b;
echo “<br />”;
echo “After Pre Increment A = “. $a;
echo “<br />”;
?>
<?php
echo “<h2>Post Increment </h2>”;
$c=5;
echo “C = “. $c;
echo “<br />”;
$d=$c++;
echo “For Post Increment D = “. $d;
echo “<br />”;
echo “After Post Increment C = “. $c;
echo “<br />”;
?>
<?php
echo “<h2>Pre decrement </h2>”;
$p=5;
echo “P = “. $p;
echo “<br />”;
$q=–$p;
echo “For Pre decrement Q = “. $q;
echo “<br />”;
echo “After Pre decrement P = “. $p;
echo “<br />”;
?>
<?php
echo “<h2>Post decrement </h2>”;
$x=5;
echo “X = “. $x;
echo “<br />”;
$y=$x–;
echo “For Post decrement Y = “. $y;
echo “<br />”;
echo “After Post decrement X = “. $x;
echo “<br />”;
?>

</body>

</html>

 

Comments

comments

About the author

Toriqul Islam Tusher

বলার মত কিছু নাই!

Leave a Comment