News for hackers. Stuff that matters.
Re:php.js - Run PHP code in JavaScript by niklasvh on Wednesday July 25, 2012 @04:54AM (#4290020)
It has no real practical use, but it was an amazing learning experience for me. So many puzzles to solve
Re:php.js - Run PHP code in JavaScript by nicholassmith on Wednesday July 25, 2012 @04:58AM (#4290035)
I can think of a couple of practical uses, the biggest one that comes to mind is helping places like CodeSchool do in browser PHP tutorials with the code actually executing. So definite practical uses :)
Re:php.js - Run PHP code in JavaScript by andreasklinger on Wednesday July 25, 2012 @05:08AM (#4290068)
This an very valid reason. The other one could be user-frontend editing of wordpress widgets or similar little nasty diy codebits.
Re:php.js - Run PHP code in JavaScript by jqueryin on Wednesday July 25, 2012 @06:20AM (#4290235)
Great use case, might I add.
Re:php.js - Run PHP code in JavaScript by koglerjs on Wednesday July 25, 2012 @01:44PM (#4292059)
As someone whose initial reaction was "God why?" I stand corrected--that's an excellent use for this project.
Re:php.js - Run PHP code in JavaScript by nicholassmith on Wednesday July 25, 2012 @02:39PM (#4292342)
Must admit I had the same reaction and then it clicked and was much more impressive.
Re:php.js - Run PHP code in JavaScript by tikhonj on Wednesday July 25, 2012 @05:09AM (#4290072)
Assuming you have strong convictions about using php instead of JavaScript, it could be very useful.

I'm actually using a similar tool (js_of_ocaml [1]) at work. It's great: we can take our product and package it for node or let people use it in the browser directly. And we can also have a native compiled version if performance is needed.

[1]: http://ocsigen.org/js_of_ocaml/

So if you have an almost religiously php-oriented shop working on something that isn't a web app, I could certainly see this being useful. That's exactly what the company I'm at is, except with OCaml instead of php. Of course, I can't actually imagine any company like that in php :P. (How many people use php for something that isn't server-side code?)

But the core idea is useful and awesome. And it's certainly very cool for a personal side-project!

Re:php.js - Run PHP code in JavaScript by julien_c on Wednesday July 25, 2012 @05:13AM (#4290084)
Out of curiosity and if you don't mind me asking, what is the OCaml-shop company you're at? Are you based out of France?
Re:php.js - Run PHP code in JavaScript by tikhonj on Wednesday July 25, 2012 @01:32PM (#4292008)
It's a really tiny startup in the Bay Area.
Re:php.js - Run PHP code in JavaScript by ericclemmons on Thursday July 26, 2012 @01:57AM (#4294621)
Actually, I stumbled on an article recently noting that you can use the V8 pecl extension for running computationally-heavy code as JS from within PHP, rather than PHP code itself, to shave off some cycles.

A tool like this, with enough support, could allow you to easily convert large chunks of slower, PHP code (like object graph hydration) into JS, run in V8 for speed, and use the result in PHP without manually converting libraries.

Re:php.js - Run PHP code in JavaScript by icoder on Wednesday July 25, 2012 @12:22PM (#4291627)
One could have a chunk of php code that needs to be run client side (for whatever reason, offline access on a chromebook being one).

PHP.js could come in handy (no need for porting the whole thing to js). Especially if this code will change over time.

Re:php.js - Run PHP code in JavaScript by charliesome on Wednesday July 25, 2012 @04:58AM (#4290034)
You're spot on. People asking 'why' or 'how is this useful?' are missing the point.
Re:php.js - Run PHP code in JavaScript by gubatron on Friday July 27, 2012 @07:02AM (#4300854)
you should waste your time solving more useful puzzles. Head into Machine Learning for example, or if you are into VMs, why not try creating a Java VM on top of Cocoa for Android developers to invade iOS, that'll have more impact and you will have to learn some serious compiler theory.