Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics (Retired) PHP Operators Operators

Seth Warner
Seth Warner
5,348 Points

So whats the difference between using auto increment and just increment. What will happen Differently by typing

by typing $corn_chowder = $corn_chowder +1;

Vs typin

$corn_chowder++;

so my question is why would someone choose one way, over the other.

Seth

1 Answer

Honestly, it's preference. I think it is preferred to use $corn_chowder++ because it's less redundant. I personally also think it's more readable that way. Especially if I am reading someone else's code. Hope that helps!

Seth Warner
Seth Warner
5,348 Points

So if you like using $corn_chowder++ how would u increase in an increment of 5? Or in that case would you have to use $corn_chowder = $corn_chowder +5;

Actually you can do $corn_chowder++5 in that case. Or whatever amount you want to increment by.