+ 2

Php code

How is it possible I don’t know???? $a =1; echo $a++; echo ++$a;

9th Jan 2019, 7:10 AM
Gauhar Rahman Niazi
Gauhar Rahman Niazi  - avatar
5 odpowiedzi
+ 10
The first echo prints 1 The second echo prints 3. He may be talking about the second echo. You can ask him again. You can refer the above answer id you have doubt about how 1 came.
9th Jan 2019, 4:17 PM
Nova
Nova - avatar
+ 7
First of all, you have to write the code inside the below block <?php ?> If you don't write the code within this, it will be taken as normal text. If you have any problem with logic then the below answer may be helpful. $a = 1 means variable a is assigned the value 1. echo $a++ means the post increment operator is used with variable a. In post-increment, the variable a is printed first then the value of a is incremented by 1. So the output will be 1 and value of a at that time will be 2. echo ++$a means pre-increment operator is used with variable a. So first value of a is incremented by 1 and then it is printed. So value of a after incrementing is 3 and 3 is printed
9th Jan 2019, 8:14 AM
Nova
Nova - avatar
+ 5
But it worked for me 😅. After running the code, I answered your question https://code.sololearn.com/wcYoSYpnG2c7/?ref=app
9th Jan 2019, 1:38 PM
Nova
Nova - avatar
+ 2
but sir you told me output 3 and tell me about the logic of programm how that possible print 13
9th Jan 2019, 1:52 PM
Gauhar Rahman Niazi
Gauhar Rahman Niazi  - avatar
+ 1
i know bro what to do if i put block of php or no ,, but sorry your answer is incorrect the output is not 3 sorry
9th Jan 2019, 10:14 AM
Gauhar Rahman Niazi
Gauhar Rahman Niazi  - avatar