Is converting javascript to php possible? #7018
Unanswered
plaffy-guy
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
Hi, great question. Of course it's possible :). All you need is AST-parser for Javascript. Then you can parser the code and map it to PHP nodes. Then you can compose them together and print with php-parser Standard printer. I've heard about Babel https://babeljs.io/, that might help you to start things of. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a project to where I have to convert valid javascript (es7) code to php code. Would it be possibly in theory to write rules such that I could find javascript syntax and then have it run through the transpiler and have it come out as php code? I wouldn't expect it to work out of the box I'm more just looking for whether or not it would be possible at all.
Apologies if this is a dumb question.
Beta Was this translation helpful? Give feedback.
All reactions