...

View Full Version : need help with a function



ragy
12-01-2010, 08:24 AM
Hello,
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

djh101
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:

<?php
$z;
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum