3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ 99 => ["number" => [1,3]], 88 => ["number" => [12,13,21]] ]; $arr2 = [ ["a"=>"01","b"=> '["01", "02", "03", "04"]'], ["a"=>"02","b"=> '["11", "12", "13"]'], ["a"=>"03","b"=> '["21", "22", "23"]'] ]; $blacklist = []; foreach ($arr1 as ['number' => $numbers]) { foreach ($numbers as $n) { $blacklist[$n] ??= str_pad($n, 2, '0', STR_PAD_LEFT); } } foreach ($arr2 as ['b' => &$b]) { $b = array_values(array_diff(json_decode($b, true), $blacklist)); } var_export($arr2);
Output for rfc.property-hooks, git.master, git.master_jit
array ( 0 => array ( 'a' => '01', 'b' => array ( 0 => '02', 1 => '04', ), ), 1 => array ( 'a' => '02', 'b' => array ( 0 => '11', ), ), 2 => array ( 'a' => '03', 'b' => array ( 0 => '22', 1 => '23', ), ), )

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:
99.93 ms | 1307 KiB | 4 Q