Increment and Decrement Operators in PHP
by TechVidvan Team
Program 1
<html>
<head><title>PHP Relational Operators</title>
<body>
<center>
<?php
$a=20; //21
$b=10; //10
if(++$a<25 or ++$b>5) // Short circuit
echo "Hello Data Flair";
else
echo "Bye Bye ";
echo "<br>";
echo "a= ".$a;
echo "<br>";
echo "b= ".$b;
// $b=$a--;
// $a=5;
// $b= ++$a + ++$a + ++$a + $a++;
// // 6+ 7 + 8 + 8
// echo "a= ".$a;
// echo "<br>";
// echo "b= ".$b;
// //$b=++$a; // $a=$a+1 .... $b=$a
// $b=$a++; // $b=$a ..... $a=$a+1
// echo $a; // 11
// echo "<br>";
// echo $b; //10
// //$a=$a+1;
//++$a; // $a=$a+1 // Pre
// $a++; // $a=$a+1 // Post
/*
++ --- Pre , Post
-- Pre,post
*/
?>
</center>
</body>
</html>
Tags: decrement operator in phpincrement and decrement operator in phpincrement operator in phpoperator in phpPHPphp increment and decrement opertaorphp operatorphp practicalphp program
TechVidvan Team
TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.