3v4l.org

run code in 300+ PHP versions simultaneously
<?php $students = [ [ 'id' => '498', 'uuid' => '6cb91efd-9111-4be8-a2d7-80d3edeed732', 'name' => 'Andrew A. Blaine', 'email' => 'student14@gmail1.com', 'usertype_id' => '6', 'first_name' => 'Andrew A.', 'last_name' => 'Blaine', ], [ 'id' => '499', 'uuid' => '208764a0-c53d-404b-ad05-ee7cba28a51c', 'name' => 'Billie C. Heath', 'email' => 'student15@gmail1.com', 'usertype_id' => '6', 'first_name' => 'Billie C.', 'last_name' => 'Heath', ] ]; $fields = ['id', 'name', 'email']; $newStudents = array_map(function ($student) use ($fields) { $newS = []; foreach ($fields as $field) { if (array_key_exists($field, $student)) { $newS[$field] = $student[$field]; } } return $newS; }, $students); print_r($newStudents);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 498 [name] => Andrew A. Blaine [email] => student14@gmail1.com ) [1] => Array ( [id] => 499 [name] => Billie C. Heath [email] => student15@gmail1.com ) )

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:
38.58 ms | 406 KiB | 5 Q