3v4l.org

run code in 300+ PHP versions simultaneously
<?php $contactArray = array( array( "CreatedAt" => "2019-04-12T11:53:26Z", "DeliveredCount" => 0, "Email" => "terry@example.org", "ExclusionFromCampaignsUpdatedAt" => "2019-04-28T09:21:35Z", "ID" => 1864410583, "IsExcludedFromCampaigns" => false, "IsOptInPending" => false, "IsSpamComplaining" => false, "LastActivityAt" => "2019-04-28T09:21:35Z", "LastUpdateAt" => "2019-04-28T09:21:35Z", "Name" => "", "UnsubscribedAt" => "", "UnsubscribedBy" => "" ), array( "CreatedAt" => "2019-04-12T12:39:30Z", "DeliveredCount" => 0, "Email" => "duane@example.org", "ExclusionFromCampaignsUpdatedAt" => "", "ID" => 1864410588, "IsExcludedFromCampaigns" => false, "IsOptInPending" => false, "IsSpamComplaining" => false, "LastActivityAt" => "2019-04-12T12:39:30Z", "LastUpdateAt" => "2019-04-12T12:39:30Z", "Name" => "", "UnsubscribedAt" => "", "UnsubscribedBy" => "" ) ); $contactDataArray = array( array( "ContactID" => 1864410583, "Data" => array( array( "Name" => "firstname", "Value" => "Mark" ), array( "Name" => "city", "Value" => "Miami" ), array( "Name" => "name", "Value" => "Terry" ), array( "Name" => "phone", "Value" => "555-5555" ) ), "ID" => 1864410583 ), array( "ContactID" => 1864410588, "Data" => array( array( "Name" => "firstname", "Value" => "Jane" ), array( "Name" => "city", "Value" => "New York" ), array( "Name" => "name", "Value" => "Duane" ), array( "Name" => "phone", "Value" => "555-5555" ) ), "ID" => 1864410588 ) ); $output = []; foreach ($contactDataArray as [ 'ID' => $id, 'Data' => [ ['Name' => $firstnameKey, 'Value' => $firstnameValue], ['Name' => $cityKey, 'Value' => $cityValue], ['Name' => $nameKey, 'Value' => $nameValue], ['Name' => $phoneKey, 'Value' => $phoneValue] ] ]) { $output[] = [ "Email" => $contactArray[array_search($id, array_column($contactArray, 'ID'))]['Email'], "ID" => $id, $firstnameKey => $firstnameValue, $cityKey => $cityValue, $nameKey => $nameValue, $phoneKey => $phoneValue ]; } var_dump($output);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(6) { ["Email"]=> string(17) "terry@example.org" ["ID"]=> int(1864410583) ["firstname"]=> string(4) "Mark" ["city"]=> string(5) "Miami" ["name"]=> string(5) "Terry" ["phone"]=> string(8) "555-5555" } [1]=> array(6) { ["Email"]=> string(17) "duane@example.org" ["ID"]=> int(1864410588) ["firstname"]=> string(4) "Jane" ["city"]=> string(8) "New York" ["name"]=> string(5) "Duane" ["phone"]=> string(8) "555-5555" } }

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:
123.52 ms | 407 KiB | 5 Q