3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'ApplicantDetails_AdditionalApplicantDetails_OtherSurnames_OtherSurname' => [['name' => 'one'], ['name' => 'two']], 'ApplicantDetails_AdditionalApplicantDetails_OtherNames' => [['surname' => 'three', 'forename' => 'forename'],['surname' => 'four']], 'ApplicantDetails_AdditionalApplicantDetails_BirthSurname' => 'birthSurname', 'ApplicantDetails_PresentSurname' => 'presentSurname' ]; $surnameKeys = [ ['ApplicantDetails_AdditionalApplicantDetails_OtherSurnames_OtherSurname', 'name'], ['ApplicantDetails_AdditionalApplicantDetails_OtherNames', 'surname'], 'ApplicantDetails_AdditionalApplicantDetails_BirthSurname', 'ApplicantDetails_PresentSurname' ]; $something = array_map(function ($keys) use ($data) { if (is_array($keys)) { if (isset($data[$keys[0]])) { return array_column($data[$keys[0]], $keys[1]); } } if (isset($data[$keys])) { return $data[$keys]; } }, $surnameKeys); var_dump($something); $uniq = array_unique($something); var_dump($uniq);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(2) { [0]=> string(3) "one" [1]=> string(3) "two" } [1]=> array(2) { [0]=> string(5) "three" [1]=> string(4) "four" } [2]=> string(12) "birthSurname" [3]=> string(14) "presentSurname" } Warning: Array to string conversion in /in/iIMA0 on line 31 Warning: Array to string conversion in /in/iIMA0 on line 31 array(3) { [0]=> array(2) { [0]=> string(3) "one" [1]=> string(3) "two" } [2]=> string(12) "birthSurname" [3]=> string(14) "presentSurname" }

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:
50.18 ms | 402 KiB | 8 Q