answersLogoWhite

0


Best Answer

The incremental operator increases the variable by 1. See the example below:

<?php

$number = 10;

$number++;

echo $number; // outputs 11

?>

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does the increment operator do in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you differentiate overloading of pre-fix and post-fix increment operator?

The prefix increment operator is overloaded as operator++() while the postfix increment operator is overloaded as operator++(int).


Can you increment the value of a variable by 2 using any increment operator?

There is no such increment operator in C language to increment the value of a variable by 2.An increment operator only increments the value by 1. however you can apply the increment operator twice to get an increment of 3. No: you cannot: ++(++a) won't compile. Yes. Example: a += 2; but += is not an increment operator, it's a shorthand of a=a+2; just like a++ is a shorthand for a= a+1


Is x plus equals y is post increment or pre increment?

The '+=' operator behaves like a pre increment operator.


What is the use of using pre increment operator?

int a, b; b = 5; /* post-increment operator */ a = b++; /* a is now 5, and b is now 6. */ /* pre-increment operator */ a = ++b; /* a and b are now both 7 */


How do you retrieve auto increment id in PHP and MySQL?

When creating the MySQL database select "Auto-Increment" on the "Extras" bar.


What is php plus plus?

PHP++ is an object-oriented version of the PHP programming language. ++ is used in programming to increment a variable by one so it means an improved version of PHP.


What is the meaning of plus plus in c?

++a (plus plus a) is pre-incrementing operator to aa=10;printf("%d",++a); /* it will print 11 as ++a increment first a by 1 then prints it */printf("%d",a++); /*it will printf 10 as it is post _ increment operator , it prints the value a first then increment it by 1 */


How do you increment a number using while in php?

Example: &lt;?php $value = 10; $i = 0 if(is_int($value)) { while($i &lt; $value) { echo $i; echo '&lt;br/&gt;'; $i++; } } ?&gt;


What are different types of operators?

The different types of operators are as follows: *Arithmatic operator *Relational operator *Logical operator *Assignment operator *Increment/Decrement operator *Conditional operator *Bitwise operator *Special operator


How different is pre and post increment in c plus plus from pre and post increment in C programming?

The pre and post increment (and decrement) operator is the same in C++ as it is in C.


How the predecrementer and postdecrementer are taken care of while declaring operator overloading?

When you overload the -- and ++ operators in C++, if you want the pre version, aka --var, simply declare the function without an argument; whereas if you want the post version, aka var--, simply declare the function with an argument of type int. class abc { public: abc&amp; operator++(); // pre-increment form abc&amp; operator++(int); // post-increment form ... }; abc::operator++() { ... pre increment stuff return *this; } abc::operator++(int) { ... post increment stuff return *this; }


What is the syntax of increment operator?

Pick one: ++ lvalue lvalue ++ lvalue += value