|
Project Information
|
PHP2jsRelease early? ... ok! :) So this is the first release of a PHP script that converts a php file to js. Whats working?
Whats not working?
Code Status
Show me something god dammit!Can has php: <?
require_once 'PHP2js.php';
new PHP2js(__FILE__);
/**
* My super cool php class that will be converted to js!!!
*/
class HelloWorld {
/**
* So here goes a function that echos
*
* @param string $foo
* @param string $bar
*/
function foo($foo, $bar) {
echo $foo . ' ' . $bar;
}
}
$H = new HelloWorld;
$H->foo();
?>Point your browser to it and you get the js code: /**
* My super cool php class that will be converted to js!!!
*/
function HelloWorld() {
/**
* So here goes a function that echos
*
* @param string $foo
* @param string $bar
*/
this.foo = function(foo, bar) {
document.write( foo + ' ' + bar);
}
}
H = new HelloWorld;
H.foo('Hello', 'World');and what you will see: Hello World See examples of working stuff here: http://code.google.com/p/php-to-js/source/browse/trunk/HelloWorld.php and http://code.google.com/p/php-to-js/source/browse/trunk/Test.php |