3v4l.org

run code in 300+ PHP versions simultaneously
<?php $VitalInfo_array = array("Title","ean","upc","ProductImageName","CdnUri","ASIN"); $Price_array = array("ListPrice","Status","ActualPrice","ProductID"); $new_array = array(); $old_array = Array ( "0" => Array ( "Title" => "HoMedics MAN-300", "ean" => "31262006288", "upc" => "31262006288", "ProductImageName" => "", "CdnUri" => "", "ASIN" => "B000050FEU", "ListPrice" => "129.99", "Status" => "2", "ActualPrice" => "129.99", "ProductID" => "5286728", ) ); //print_r($old_array); foreach($old_array as $key_old => $val_old) { foreach($val_old as $key => $val) { if(in_array($key, $VitalInfo_array)) { //$temp_val = $key=>$val; $new_array[$key_old]['VitalInfo'][$key] = $val; } else { //$temp_val = $key=>$val; $new_array[$key_old]['Price'][$key] = $val; } } } print_r($new_array);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [VitalInfo] => Array ( [Title] => HoMedics MAN-300 [ean] => 31262006288 [upc] => 31262006288 [ProductImageName] => [CdnUri] => [ASIN] => B000050FEU ) [Price] => Array ( [ListPrice] => 129.99 [Status] => 2 [ActualPrice] => 129.99 [ProductID] => 5286728 ) ) )

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