If anyone wants a more efficient local version for php:
function isEven(int $number): bool { ${1} = false; ${2} = true; while ($number > 2) { $number -= 2; } return $$number; }
Submitted 11 months ago by mac@programming.dev to programmer_humor@programming.dev
If anyone wants a more efficient local version for php:
function isEven(int $number): bool { ${1} = false; ${2} = true; while ($number > 2) { $number -= 2; } return $$number; }
I fucking love that you managed to use var-vars in a completely key and necessary manner.
This looks pretty inefficient. You should manually unroll that loop to improve performance.
Comment edits are the best version control system
I agree! Added new commit to my comment.
Oh, bummer, my number isn’t supported by the free version:
Just divide that number by two until it’s small enough to make the request under the free version.
pretty sure that has to be against their TOS
/s
That’s not even supported by the enterprise version. You’re going to need a special agreement with the iseven people to support numbers like that
Only way it could be better is if they threw “AI” in there somewhere.
With the new AI integration, you can get smart isEven results that return the correct answer 90% of the time and a more creative solution 20% of the time.
im glad that people are out there building the web services we truly need.
I love that it works and the ads are pretty good.
The errors are great api.isevenapi.xyz/api/iseven/1.5
Sadly it’s not always accurate api.isevenapi.xyz/api/iseven/0
Is even states that it only returns true for even, passing in an odd number is technically unsupported.
zero is even, so i dont see how that one’s wrong
Oh you’re right, I’m not sure what I was Ln thinking
Funny as hell
4am@lemm.ee 11 months ago
Incoming trademark lawsuit from iSeven, the API that tells you if a number is seven or not