<?php
function Add($x,$y) {
    return 
$x+$y;
}

$server = new SoapServer(null,array('uri'=>"http://test-uri/"));
$server->addFunction("Add");
$server->handle();
?>
Or using a WSDL:

<?php
function Add($x,$y) {
    return 
$x+$y;
}

$server = new SoapServer("./add.wsdl");
$server->addFunction("Add");
$server->handle();
?>
add.wsdl
<?xml version="1.0" ?>
<definitions
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:si="http://soapinterop.org/xsd"
 xmlns:tns="http://localhost/~rasmus/pecl/soap/test.wsdl"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 targetNamespace="http://localhost/~rasmus/pecl/soap/test.wsdl">

 <types>
   <xsd:schema targetNamespace="http://localhost/~rasmus/pecl/soap/test.wsdl">
     <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
     <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
   </xsd:schema>
 </types>

 <message name="AddRequest">
   <part name="x" type="xsd:double" />
   <part name="y" type="xsd:double" />
 </message>
 <message name="AddResponse">
   <part name="result" type="xsd:double" />
 </message>

 <portType name="TestServicePortType">
   <operation name="Add">
     <input message="tns:AddRequest" />
     <output message="tns:AddResponse" />
   </operation>
 </portType>

 <binding name="TestServiceBinding" type="tns:TestServicePortType">
   <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
   <operation name="Add">
     <soap:operation soapAction="Add" style="rpc" />
     <input>
       <soap:body use="encoded" 
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
     </input>
     <output>
       <soap:body use="encoded" 
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
     </output>
   </operation>
  </binding>

 <service name="TestService">
   <port name="TestServicePort" binding="tns:TestServiceBinding">
     <soap:address location="http://localhost/~rasmus/pecl/soap/soap_server.php"/>
   </port>
 </service>

</definitions>