3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ ['Code' => 'DES001', 'Commennte' => '', 'Quantity' => 1, 'Price' => '135.00', 'Unity' => 1] ]; // expected <value><![CDATA...</value> payload $payload = [ 'Pedido' => [ 'Nombre' => '', 'Producto' => [ 'Product' => [ [ 'ClaveProducto' => $data[0]['Code'], 'Cantidad' => $data[0]['Quantity'], 'Precio' => $data[0]['Price'], 'Unidad' => 'PIEZA', 'Comentario' => '', ] ] ], ] ]; // init domdocument $xml = new DOMDocument("1.0", "ISO-8859-15"); // optional $xml->preserveWhiteSpace = false; $xml->formatOutput = true; // create request wrapper $request = $xml->createElement("request"); // create method (CDATA), append it to the wrapper $method = $xml->createElement("method"); $method->appendChild($xml->createCDATASection('registra')); // create param wrapper $param = $xml->createElement("param"); // create name (CDATA), append it to the param $name = $xml->createElement("name"); $name->appendChild($xml->createCDATASection('pedido')); $param->appendChild($name); // create value (CDATA), append it to the param $value = $xml->createElement("value"); $value->appendChild($xml->createCDATASection(json_encode($payload))); $param->appendChild($value); // append method to request $request->appendChild($method); // append param to request $request->appendChild($param); // request root $xml->appendChild($request); // output echo $xml->saveXML($xml->documentElement);
Output for git.master, git.master_jit, rfc.property-hooks
<request> <method><![CDATA[registra]]></method> <param> <name><![CDATA[pedido]]></name> <value><![CDATA[{"Pedido":{"Nombre":"","Producto":{"Product":[{"ClaveProducto":"DES001","Cantidad":1,"Precio":"135.00","Unidad":"PIEZA","Comentario":""}]}}}]]></value> </param> </request>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
87.1 ms | 401 KiB | 8 Q