Generating Javascript from PHP?
- by Aristotle
Are there any libraries or tools specifically designed to help PHP programmers write Javascript? Essentially, converting the PHP logic into Javascript logic. For instance:
$document = new Document($html);
$myFoo = $document->getElementById("foo");
$myFoo->value = "Hello World";
Being converted into the following output:
var myFoo = document.getElementById("foo");
myFoo.value = "Hello World";
Of course it would be excellent if more complicated solutions could be derived too, perhaps converting objects and internal methods into javascript-objects, etc.