Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help with a function

    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

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    Might I suggest reading through a basic PHP tutorial (http://tizag.com would be a good place for that). The function would be:
    PHP Code:
    <?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.
    Last edited by djh101; 12-01-2010 at 08:58 AM.
    "Yeah science!"
    Online Science Tools


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •