3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(array('data1','data1'), array('data2','data2'), array('',''), array('data4','data4')); $array = array_filter(array_map('array_filter', $array)); print_r($array);
Output for 5.6.38, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14, 8.4.1
Array ( [0] => Array ( [0] => data1 [1] => data1 ) [1] => Array ( [0] => data2 [1] => data2 ) [3] => Array ( [0] => data4 [1] => data4 ) )

preferences:
46.9 ms | 408 KiB | 5 Q