Why --$y has no effect on char or string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Why --$y has no effect on char or string?

$y = 'a'; --$y; echo $y; //output: a

15th Jun 2017, 2:46 AM
Nafis
Nafis - avatar
2 Answers
+ 2
Character variables in php can only be incremented and not decremented. http://php.net/manual/en/language.operators.increment.php
15th Jun 2017, 3:18 AM
ChaoticDawg
ChaoticDawg - avatar
0
only +++ cannot --character in php
17th Jun 2017, 8:31 AM
Waseem