3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml_1 = '<namesilo> <request> <operation>getDomainInfo</operation> <ip>55.555.55.55</ip> </request> <reply> <code>300</code> <detail>success</detail> <created>2009-01-11</created> <expires>2017-01-11</expires> <status>Active</status> <locked>Yes</locked> <private>Yes</private> <auto_renew>Yes</auto_renew> <traffic_type>Forwarded</traffic_type> <email_verification_required>No</email_verification_required> <portfolio>Main Portfolio</portfolio> <forward_url>https://www.namesilo.net</forward_url> <forward_type>Temporary Forward (302)</forward_type> <nameservers> <nameserver position="1">NS1.NAMESILO.COM</nameserver> <nameserver position="2">NS2.NAMESILO.COM</nameserver> </nameservers> <contact_ids> <registrant>444444</registrant> <administrative>555555</administrative> <technical>666666</technical> <billing>7777777</billing> </contact_ids> </reply> </namesilo>'; $xml_2 = '<namesilo><request><operation>checkRegisterAvailability</operation><ip>1.1.1.1</ip></request><reply><code>300</code><detail>success</detail><available><domain price="11.79" premium="0">nononononodneodneond.net</domain></available></reply></namesilo>'; $simple_test_1 = new simplexmlelement($xml_1); $simple_test_2 = new simplexmlelement($xml_2); function formatResponse($data, $assoc = false) { $data = json_decode(json_encode($data)); $data = formatAttributes($data); return json_decode(json_encode($data), $assoc); } function formatAttributes($attributes) { foreach ($attributes as $key => $attribute) { if (is_array($attribute)) { $attributes->{$key} = formatAttributes((object)$attribute); $attributes->{$key} = (array)$attributes->{$key}; } if (is_object($attribute)) { $attributes->{$key} = formatAttributes($attribute); if (isset($attribute->{'@attributes'})) { unset($attributes->{$key}->{'@attributes'}); } } if (!is_scalar($attributes->{$key})) { foreach ($attributes->{$key} as $a_key => $items) { if (!is_scalar($items)) { if (count((array) $items) == 1 && is_array($attributes->{$key})) { $attributes->{$key}[$a_key] = $items->{0}; } if (count((array) $items) == 1 && is_object($attributes->{$key})) { if (isset($items->{0})) { $attributes->{$key}->{$a_key} = $items->{0}; } } } } } } return $attributes; } print_r(formatResponse($simple_test_1)); print_r(formatResponse($simple_test_2));
Output for git.master, git.master_jit, rfc.property-hooks
stdClass Object ( [request] => stdClass Object ( [operation] => getDomainInfo [ip] => 55.555.55.55 ) [reply] => stdClass Object ( [code] => 300 [detail] => success [created] => 2009-01-11 [expires] => 2017-01-11 [status] => Active [locked] => Yes [private] => Yes [auto_renew] => Yes [traffic_type] => Forwarded [email_verification_required] => No [portfolio] => Main Portfolio [forward_url] => https://www.namesilo.net [forward_type] => Temporary Forward (302) [nameservers] => stdClass Object ( [nameserver] => Array ( [0] => NS1.NAMESILO.COM [1] => NS2.NAMESILO.COM ) ) [contact_ids] => stdClass Object ( [registrant] => 444444 [administrative] => 555555 [technical] => 666666 [billing] => 7777777 ) ) ) stdClass Object ( [request] => stdClass Object ( [operation] => checkRegisterAvailability [ip] => 1.1.1.1 ) [reply] => stdClass Object ( [code] => 300 [detail] => success [available] => stdClass Object ( [domain] => nononononodneodneond.net ) ) )

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:
65.21 ms | 405 KiB | 8 Q