3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = array('phrase', 'fruit'); $ar = ['a'=>'apple', 'b'=>'banana', 'c'=>'pear']; $new_ar = array_map(function ($v, $k) use ($keys) { return array_combine($keys, array($k, $v)); }, $ar, array_keys($ar)); print_r($new_ar);

preferences:
25.2 ms | 407 KiB | 5 Q