Page 1 of 1

Re: Pho function return

Posted: Tue May 21, 2013 5:44 pm
by hallsofvallhalla
i am not sure what exactly you are going for here but to return a function in php

Code: Select all

$result = ResolveBattle($playerinfo3);

function ResolveBattle($playerinfo3)
{
$roll = $playerinfo3['attack'] + rand(1,20);
return $roll
}
$result will have the roll + the players attack


Hope that helps

Re: Pho function return

Posted: Wed May 22, 2013 12:06 am
by Jackolantern
I am a bit confused by this as well. You are talking about "on click" the function is called, but PHP doesn't work that way, but the code you posted is PHP code.

Re: Php function return

Posted: Wed May 22, 2013 2:27 am
by Jackolantern
Oh, I gotcha! I thought you meant like a click event, such as in Javascript. :cool: