-1
Post-increment problem returning 67 and returning 7:
<?php
$a = 10;
$b = 6;
echo ++$a; // pré incremento
echo "<br>";
echo $b++;
"<br>";
echo$b; // pós incremento
echo"<br>";
echo--$a;// pré decremento
?>
-1
Post-increment problem returning 67 and returning 7:
<?php
$a = 10;
$b = 6;
echo ++$a; // pré incremento
echo "<br>";
echo $b++;
"<br>";
echo$b; // pós incremento
echo"<br>";
echo--$a;// pré decremento
?>
3
You probably just forgot to put one echo
. So you must do what you wish:
$a = 10;
$b = 6;
echo ++$a; // pre incremento
echo "<br>";
echo $b++;
echo "<br>";
echo$b; // pós incremento
echo"<br>";
echo--$a;// pré decremento
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
In his code, he had 6 printed "<br>"
loose that disappears in the result and then has printed the 7, as there is nothing separating them is 67.
that was really thank you
@Gabrielflor see on [tour] the best way to say thank you.
Browser other questions tagged php echo
You are not signed in. Login or sign up in order to post.
Comes out 67 only because the two values appear together. Note that you did not put the
echo
in the"<br>"
between the values, which made PHP simply ignore the string. See https://repl.it/@acwoss/Cookednaturaltelephones.– Woss
For tag used previously you should read this: https://answall.com/q/101691/101
– Maniero
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero