3 ms·
I think “run PHP in the browser” is overstating what this does, it's a naïve source-to-source translator and will not run any non-trivial PHP application, becau
by TazeTSchnitzel 6y ago
I think “run PHP in the browser” is overstating what this does, it's a naïve source-to-source translator and will not run any non-trivial PHP application, because JS and PHP have very different semantics. There are more sophisticated existing projects that actually try to compile PHP code or the PHP interpreter for the browser.
- pornel 6y agoAuthor here. Yes, it's an approximate conversion favoring readable output over exact semantics, so it won't run WordPress. It might still be useful for smaller pieces of code. If you want to rewrite a PHP program in JS (which may be a bad idea…), it will do the most tedious step for you. I wrote it just as a proof of concept. It was a warm-up before writing a similar tool for C to Rust source-to-source translation: https://lib.rs/citrus https://lib.rs/citrus
- 1337shadow 6y agoThe point is to export some functions I suppose, ie. code server side form validation and have it converted to frontend code too (assuming it doesn't need to hit the database)