3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_one = [ [ 'product_id' => 1, 'product_stock' => '1.2', 'stock_date' => '2022-02-15' ], [ 'product_id' => 2, 'product_stock' => '5', 'stock_date' => '2022-02-15' ], ]; $array_two = [ [ 'product_id' => 1, 'product_slug' => 'product_one', 'product_description' => 'this is the product one' ], [ 'product_id' => 2, 'product_slug' => 'product_two', 'product_description' => 'this is the product two' ], [ 'product_id' => 3, 'product_slug' => 'product_three', 'product_description' => 'this is the product three' ], ]; $lookup = array_column($array_two, null, 'product_id'); var_export( array_map( fn($row) => $row + $lookup[$row['product_id']], $array_one ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'product_id' => 1, 'product_stock' => '1.2', 'stock_date' => '2022-02-15', 'product_slug' => 'product_one', 'product_description' => 'this is the product one', ), 1 => array ( 'product_id' => 2, 'product_stock' => '5', 'stock_date' => '2022-02-15', 'product_slug' => 'product_two', 'product_description' => 'this is the product two', ), )

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:
77.76 ms | 406 KiB | 5 Q