3
\$\begingroup\$

Now I don't know PHP or how exactly it fits into HTML, but I had an idea that you could run a PHP script in a Stack Snippet. Is this true, and if so could you give some examples?

\$\endgroup\$

2 Answers 2

9
\$\begingroup\$

This is impossible. PHP is server-side, but snippets are client-side.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ You could theoretically add support for server-side snippets, but I don't even want to think about that security disaster. \$\endgroup\$
    – orlp
    Commented Aug 26, 2015 at 9:00
  • \$\begingroup\$ There are services like repl.it that support languages like PHP, so I assume it wouldn't be impossible to make it secure. \$\endgroup\$ Commented Aug 26, 2015 at 9:04
  • 2
    \$\begingroup\$ repl.it tends to disable entire imports or groups of functions, (maybe for security?). One example is you cannot import json in Python. \$\endgroup\$
    – mbomb007
    Commented Aug 26, 2015 at 21:55
2
\$\begingroup\$

Perhaps, if somebody added a PHP-to-Javascript converter like the other converters shown here, it could be possible. It would most likely be only a partial solution capable of only a subset of PHP's features, if ever implemented, since some wouldn't be possible.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .