Skip to content

remove unnecessary operation in code example #2667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

aghArdeshir
Copy link

@aghArdeshir aghArdeshir commented Aug 9, 2023

in this example, $count-- at the end of the function helps with nothing. Its existence also does not harm anything. But because in the same file, in "Example # 4 Example demonstrating need for static variables" we were talking about how useless $a++ is in that example, putting a useless $count-- can be misleading in this example, because the reader may look for the philosophy/reason behind existence of this statement.

in this example, `$count--` at the end of the function helps with nothing. Its existence also does not harm anything. But because in the same file, in "Example php#4 Example demonstrating need for static variables" we were talking about how useless `$a++` is in that example, putting a useless `$count--` can be misleading in this example, because the reader may look for the philosophy/reason behind existence of this statement.
@Girgias
Copy link
Member

Girgias commented Aug 9, 2023

This statement is needed to reset the value when doing a follow-up call to test(), it would be better to add a coment, or create another without the statement and have it call test() twice. In any case showing the output of this code would be a good enhancement

@aghArdeshir
Copy link
Author

Thanks @Girgias. I agree with you and I believe your point is correct.

So I'll close this PR. Hopefully me or someone else in near/distant future improves the example in one of the ways you suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants