3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $faultMessage = "Hello World"; $faultCode = "123"; $responseFaultDetailXML = <<<XML <detail> <pfresponse:FaultResponse> <FaultResponseString>$faultMessage</FaultResponseString> </pfresponse:FaultResponse> </detail> XML; $responseFaultDetail = new SimpleXMLElement($responseFaultDetailXML); $newSoapFault = new SoapFault($faultCode, $faultMessage, null, $responseFaultDetail); print_r($newSoapFault);
based on FGrQ2
Output for 7.0.0 - 7.2.0
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix pfresponse on FaultResponse is not defined in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): <pfresponse:FaultResponse> in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): ^ in /in/TOIUT on line 12 Fatal error: Uncaught Error: Class 'SoapFault' not found in /in/TOIUT:14 Stack trace: #0 {main} thrown in /in/TOIUT on line 14
Process exited with code 255.
Output for 5.4.9 - 5.6.28
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix pfresponse on FaultResponse is not defined in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): <pfresponse:FaultResponse> in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): ^ in /in/TOIUT on line 12 Fatal error: Class 'SoapFault' not found in /in/TOIUT on line 14
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix pfresponse on FaultResponse is not defined in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): <pfresponse:FaultResponse> in /in/TOIUT on line 12 Warning: SimpleXMLElement::__construct(): ^ in /in/TOIUT on line 12 SoapFault Object ( [message:protected] => Hello World [string:Exception:private] => [code:protected] => 0 [file:protected] => /in/TOIUT [line:protected] => 14 [trace:Exception:private] => Array ( ) [previous:Exception:private] => [faultstring] => Hello World [faultcode] => 123 [detail] => SimpleXMLElement Object ( [pfresponse:FaultResponse] => SimpleXMLElement Object ( [FaultResponseString] => Hello World ) ) )