3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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]])) { $something[] = array_column($data[$keys[0]], $keys[1]); continue; } } if (isset($data[$keys])) { $something[] = $data[$keys]; } }, $surnameKeys); var_dump($something); $uniq = array_unique($something); var_dump($uniq);
based on iIMA0
Output for 7.0.0 - 7.1.7
Fatal error: 'continue' not in the 'loop' or 'switch' context in /in/V7vEN on line 22
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Cannot break/continue 1 level in /in/V7vEN:22 Stack trace: #0 (): Closure$() #1 /in/V7vEN(29): array_map() #2 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Cannot break/continue 1 level in /in/V7vEN on line 22
Process exited with code 255.