3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array ( "products" => array( "category" => array( array( "product_sku" => "1", "product_type" => "Type", "customer_contact_name" => "Contact Name", "customer_telephone" => "0000 000 000", "customer_email" => "email@email.com", "customer_postcode" => "PostCode", "additional_info" => array( "some information" => "some information" ), "full_price" => "50.00", "product_name" => "Product Name", "product_id" => "1", "customer_rating" => "0" ), array( "product_sku" => "2", "product_type" => "Type", "customer_contact_name" => "Contact Name", "customer_telephone" => "0000 000 000", "customer_email" => "email@email.com", "customer_postcode" => "PostCode", "additional_info" => array( "some information" => "some information" ), "full_price" => "100.00", "product_name" => "Product Name", "product_id" => "2", "customer_rating" => "0" ) ) ) ); $array2 = array ( array( "product_sku" => "1", "product_type" => "Type", "contact_name" => "Contact Name", "phone" => "0000 000 000", "full_price" => "0.00", "product_name" => "Product Name", "product_id" => "1", "rating" => "0" ), array( "product_sku" => "3", "product_type" => "Type", "contact_name" => "Contact Name", "phone" => "0000 000 000", "full_price" => "80.00", "product_name" => "Product Name", "product_id" => "3", "rating" => "0" ) ); $skuFullPrices = array_column( $array1['products']['category'], 'full_price', 'product_sku' ); $array2 = array_map( fn($row) => array_replace( $row, ['full_price' => $skuFullPrices[$row['product_sku']] ?? $row['full_price']] ), $array2 ); usort( $array2, fn($a, $b) => $a['full_price'] <=> $b['full_price'] ); var_export($array2);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'product_sku' => '1', 'product_type' => 'Type', 'contact_name' => 'Contact Name', 'phone' => '0000 000 000', 'full_price' => '50.00', 'product_name' => 'Product Name', 'product_id' => '1', 'rating' => '0', ), 1 => array ( 'product_sku' => '3', 'product_type' => 'Type', 'contact_name' => 'Contact Name', 'phone' => '0000 000 000', 'full_price' => '80.00', 'product_name' => 'Product Name', 'product_id' => '3', 'rating' => '0', ), )

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.31 ms | 407 KiB | 5 Q