PHP 8.5.0 Beta 1 available for testing

Voting

: two minus two?
(Example: nine)

The Note You're Voting On

turn_and_turn at sina dot com
5 years ago
// init lua
$lua = new Lua();

/**
* Hello world method
*/
function helloWorld()
{
return "hello world";
}

// register our hello world method
$lua->registerCallback("helloWorld", helloWorld);
$lua->eval("
-- call php method
local retVal = helloWorld()

print(retVal)
");

// register our hello world method but using an other name
$lua->registerCallback("worldHello", helloWorld);

// run our lua script
$lua->eval("
-- call php method
local retVal = worldHello()

print(retVal)
");

<< Back to user notes page

To Top