My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
91–97 of 97 posts
Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#92Earlier quoted context omitted.
Ut oh? I've never seen that, is it variant on uh oh or something else?
It's something I'm fighting for in my own little way. Everyone does a glottal stop between the "uh" and "oh", so I'm trying to align the spelling Unlike the guy on him who writes all years with 5 digits like 02026, I have good reasons for my idiosyncracies.
"Uh'oh" is more readable in my opinion and won't be mispronou in ced
Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#93Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#94Author here, happy to answer any questions. I never imagined a polyfill for http_build_url would gain so much traction. After 12 years, deprecating it feels like the right move, especially given the new options from the community and PHP itself.
The JavaScript world is littered with stuff comparing to which your patch seems like a complex project. See those examples: https://www.npmjs.com/package/is-odd https://www.npmjs.com/package/is-even https://www.npmjs.com/package/left-pad https://www.npmjs.com/package/is-whitespace-character https://www.npmjs.com/package/isarray
> 'use strict';
> var isOdd = require('is-odd');
> module.exports = function isEven(i) {
> return !isOdd(i);
> };
Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#95Earlier quoted context omitted.
I feel like I have to remind people of this quite often, but the history is such that npm was lightweight at one point, bundling wasn't a thing, and while `isodd`/`iseven` are of course silly, things like `isarray` were not functions that existed back then (we didn't have Array.isArray). `typeof [] === 'object'` in JS, so e.g. my package `is-arrayish` checked for a similar structure to an array (whereas Id guess `isa…
You want to implement your own is-odd in your code - simple, right? isOdd = (x) => x % 2 == 1 Ut oh, your code is broken for negative numbers now since % isn't a true modulo operator... Fine then, isOdd = (x) => x % 2 != 0 Ut oh, your code is broken because isOdd("hi") returns true now... Fine then, isOdd = (x) => if(!isNumber(x)) throw... else return x%2 != 0 Ut oh, your code is now broken because isOdd(2^55+1) retu…
I think you messed up this example. Whether I literally use "2^55" with XOR or replace it with "2*55", that version of isOdd returns false.
False for isOdd(58) is obviously correct. (Also thanks C for permanently screwing up the precedence of bitwise operations because you didn't want to break some existing programs in 1972.)
False for isOdd(36028797018963970) is also correct, and if you expected to send in a different number the bug is in the "+1" not the isOdd.
Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#96Earlier quoted context omitted.
The JavaScript world is littered with stuff comparing to which your patch seems like a complex project. See those examples: https://www.npmjs.com/package/is-odd https://www.npmjs.com/package/is-even https://www.npmjs.com/package/left-pad https://www.npmjs.com/package/is-whitespace-character https://www.npmjs.com/package/isarray
is-even implementation: > 'use strict'; > var isOdd = require('is-odd'); > module.exports = function isEven(i) { > return !isOdd(i); > };
Surely the author's gotta be trolling, right?
Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it
#97Omg, PHP... I ditched this language 7 years ago, because I was fed up with the context switching (fullstack webdev). In the beginning I really was enjoying the gentle slope of learning. I could do a lot without knowing what classes, objects and types are. And I am grateful for this, because thanks to it, now I am here where I can do much more powerful things knowing classes, objects, types and paradigms
PHP kept on getting professional attention and development, and so now it also has all those things you mentioned.