3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = array( 'percy' => array( 'philip' => array( 'mitch' => array( 'percy' => 'hatcherson', 'mitch' => 'anderson' ) ), 'mitch' => array( 'mitchell', 'anderson', 'percy' => array( 'percy', 'hatcherson' ), 'mitchell' => 'thomas mitchell anderson', 'percy' => 'percy philip hatcherson' ) ) ); $newArray = array_column($testArray, 'percy'); var_dump($newArray); exit(); foreach ($testArray as $k => $v) { if (is_array($v)) { $newArray[] = array_merge($newArray, array_column($v, 'percy')); } } var_dump($newArray);

preferences:
47.3 ms | 402 KiB | 5 Q