3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "manufacturer" => "BB", "width" => "245, 225", "height" => "45, 65", "diameter" => "19, 17", "type" => "AA", ]; $mandatoryFields = [ 'width', 'height', 'diameter', ]; var_export( array_map( null, ...array_values( array_map( fn($v) => explode(', ', $v), array_intersect_key( $arr, array_flip($mandatoryFields) ) ) ) ) );
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array ( 0 => array ( 0 => '245', 1 => '45', 2 => '19', ), 1 => array ( 0 => '225', 1 => '65', 2 => '17', ), )

preferences:
130.31 ms | 402 KiB | 121 Q