S. Johnson
S. Johnson

Reputation: 21

How to make a PHP and JS backend?

I know that you can use PHP or node.js server-side, but is it possible to use both PHP and JS together, for example PHP calling a JS function?

My goal is to call JS for the more intensive math functions, but I don't want these to be seen on the clientside. I've tried searching many different sites but it seems my question is pretty specific. Thanks

Upvotes: 0

Views: 276

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1074295

There are a couple of ways to do this:

  1. Use some kind of bridging technology. The briefest search turned up this one, for instance. Edit: User blues mentions PHP V8js as well.

  2. Have a Node process running and bound only to localhost, and have your PHP code make queries to it (perhaps via HTTP).

Upvotes: 2

Related Questions