Skip to content

Simplify PHP code for fibonacci#427

Open
joanhey wants to merge 3 commits intobddicken:mainfrom
joanhey:patch-1
Open

Simplify PHP code for fibonacci#427
joanhey wants to merge 3 commits intobddicken:mainfrom
joanhey:patch-1

Conversation

@joanhey
Copy link

@joanhey joanhey commented May 15, 2025

I have:

  • Read the project README, including the benchmark descriptions
  • Read the PR template instructions before I deleted them
  • Understood that if I have changed something that could impact performance of one or more contributions, I should provide results benchmark runs, using the run.sh script, from before and after the change.

Description of changes

First a == comparison is slower than a === comparison.
As we have match now, we can simplify the code, and as match() is a === comparison (equality) teorically need to be faster.

Use $n < 2 only 1 comparison like in other languages. So it's faster.

@joanhey joanhey marked this pull request as draft May 16, 2025 07:34
@joanhey joanhey marked this pull request as ready for review May 18, 2025 12:10
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.

1 participant