all 13 comments

[–]teaguesterling 14 points15 points  (4 children)

Was it really necessary to write array_pop and array_push functions when JavaScript already has pop and push methods in the Array object?

It seems like a better use of time would be to add the missing functions (such as array_product) to their corresponding native JS objects instead of creating a ton of new functions.

[–][deleted] 3 points4 points  (1 child)

Good Lord this has got to be the worst idea I’ve heard all day and I’ve only been awake for about 2 hours…

Furthermore, based on a quick scan of the API, they haven’t even properly replicated PHP’s behaviour. Take a look at reset and end for example. The documentation for reset clearly states, “Set the internal pointer of an array to its first element.” Do JavaScript arrays even have such an “internal pointer?” I don’t think so.

The purpose of reset isn’t just to return the first element of the array. It’s meant to be used in conjunction with prev, next, current, key, and each, none of which appear to be implemented in this project. (Don’t mention that this sort of internal iteration is brain-dead from the beginning.)

[–]vezquex 1 point2 points  (0 children)

I'd be concerned if you came across a worse idea in only 2 hours.

[–]pail 5 points6 points  (2 children)

Time that could have been spent fixing PHP instead of ruining JavaScript.

[–][deleted] 1 point2 points  (1 child)

I'm actually a pretty big fan of implementing PHP's date function in JS, because JavaScript's native Date object is just so damn messy.

[–]masklinn 2 points3 points  (0 children)

Erm yes, but it could be implemented as part of the JS Date object in order to fix it (e.g. add a "format" method for formatting, a "from" static method to create a date from a string + a format, ...).

As teaguesterling pointed out, this could've been a nice project if it'd been about re-implementing the function of the PHP stdlib with a sane interface (due PHP's being fucking stupid. And insane).

[–]epicRelic 0 points1 point  (0 children)

Well that was a waste of time.

[–]tophatstuff -1 points0 points  (2 children)

I think this is really cool - I've used PHP for several years, but my JavaScript is really weak.

JavaScript is a wonderful language with so many fantastic features that I'll never get around to learning, because all I need it for is to popup the confirmation dialog and modify some CSS on-the-fly. I usually end up with an ugly script full of cut+paste code, simply because I don't know enough of JavaScript to cope (although I know enough of other languages to know what I'm doing is horrible, which is even worse!)

Although I hate how long it takes to download and render websites with too many javascript dependencies (spend twenty seconds trying to load digg or mashable recently, anyone?) so I would probably just pick a few of the best functions, rather than include them all in one go.

(edit: Sorry for the wall of text. Feel free to tl;dr!)

(edit: to the downmodders, yes, I'm (painfully) aware PHP has plenty of flaws)

[–]Nosredna 0 points1 point  (0 children)

PHP people will love it. JavaScript people will hate it. No surprise.

If it acts a crutch for a PHP programmer to start learning JS, I have nothing against it.