+ 3

PHP - Pre and Post Increment and Decrement Confusion

PHP - Pre and Post Increments and Decrements Confusion Hey everyone! I am a teen and I am learning PHP, and I cannot understand what Pre and Post Increments and Decrements are and what their usages are. Things I want to know: What are Increments and Decrements? What are they used for? Thanks!

1st Nov 2019, 10:16 PM
Brock Miller
Brock Miller - avatar
10 ответов
+ 11
https://code.sololearn.com/wKNpHCyYyQd2/?ref=app Check this code and also read comments for better understanding
3rd Nov 2019, 6:07 AM
Ayushi Gujarati
Ayushi Gujarati - avatar
+ 3
Sorry that seemed the case! I use exclamations to show positivity, not sarcasm. Thanks for the solution!
2nd Nov 2019, 12:10 AM
Brock Miller
Brock Miller - avatar
+ 2
Thats a really helpful and detailed explanation. Thanks, Aayushi Gujarati !
3rd Nov 2019, 3:28 PM
Brock Miller
Brock Miller - avatar
+ 1
Actually, that wasn’t sarcastic in the least, I just somehow skipped over that in my brain... you can choose to take offense to something that is nothing, but hey! I can’t make that decision for you.
2nd Nov 2019, 12:01 AM
Brock Miller
Brock Miller - avatar
0
Xyenia 🦉 , I did. I am just not sure of a real world application.
1st Nov 2019, 11:34 PM
Brock Miller
Brock Miller - avatar
0
Oh! That makes sense! Thanks, Xyenia 🦉 !
1st Nov 2019, 11:49 PM
Brock Miller
Brock Miller - avatar
- 1
It's in the PHP course. Do the course. https://www.sololearn.com/learn/PHP/1803/
1st Nov 2019, 11:32 PM
Xyenia 🦉
Xyenia 🦉 - avatar
- 1
You can use them in loops for iterations.
1st Nov 2019, 11:47 PM
Xyenia 🦉
Xyenia 🦉 - avatar
- 1
You are liking your own answers and being sarcastic with your last answer. You seem wise enough to ask a decent question with some code terminology yet you do not comprehend an "iteration"?
1st Nov 2019, 11:55 PM
Xyenia 🦉
Xyenia 🦉 - avatar
- 1
All your exclamations suggest sarcasm. I apologize if that's not the case. Yes, increments and decrements are used for repetitive runs (iterations) inside loops until the end result has been achieved.
2nd Nov 2019, 12:07 AM
Xyenia 🦉
Xyenia 🦉 - avatar