Php program to print the number using pre-increment operator

A Php program to print the number using pre-increment operator. In this program we can increment the value in previsouly using operator. Before utilising a variable in an expression, a pre-increment operator is used to increase its value. The value is first increased and then used inside the expression in the Pre-Increment.

<?php
$x = 10;
echo ++$x;
?>

 

Output:

11

What is Php increment operator in php

PHP offers a built-in method for incrementing a number or a string by appending ++ to the end of the variable. PHP supports pre- and post-increment and decrement operators in the C manner. Only numbers and strings are affected by the increment/decrement operators. Arrays, objects, booleans, and resources are unaffected by this change. Null values have no effect when decremented, but when incremented, they result in 1.