View Full Version : need help with a function

12-01-2010, 08:24 AM
I wanna create a simple webservice that sum two digits, that means when i send 2 , 4 to the function it returns 6.

Note: that my server support SOAP

12-01-2010, 08:55 AM
Might I suggest reading through a basic PHP tutorial (http://tizag.com would be a good place for that). The function would be:

function someFunction($x,$y){ //define function
$z = $x + $y; //add $x and $y and store them in $z
echo $x." + ".$y." = ".$z; //output $x + $y = $z ($x, $y, and $z will be replaced with their values)
someFunction(2,4); //call function with 2 and 4 as parameters
Right now someFunction activates itself with preset variables. If you plan on using forms to submit numbers, you can replace 2 and 4 with post or get values.