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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iIMA0
function name:  (null)
number of ops:  20
compiled vars:  !0 = $data, !1 = $surnameKeys, !2 = $something, !3 = $uniq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiIMA0%3A17%240'
          4        BIND_LEXICAL                                             ~6, !0
   27     5        SEND_VAL                                                 ~6
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $7      
   17     8        ASSIGN                                                   !2, $7
   29     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   31    12        INIT_FCALL                                               'array_unique'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !3, $10
   32    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FiIMA0%3A17%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/iIMA0
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $keys, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   18     2        TYPE_CHECK                                  128          !0
          3      > JMPZ                                                     ~2, ->15
   19     4    >   FETCH_DIM_R                                      ~3      !0, 0
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~3
          6      > JMPZ                                                     ~4, ->15
   20     7    >   INIT_FCALL                                               'array_column'
          8        FETCH_DIM_R                                      ~5      !0, 0
          9        FETCH_DIM_R                                      ~6      !1, ~5
         10        SEND_VAL                                                 ~6
         11        FETCH_DIM_R                                      ~7      !0, 1
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                         $8      
         14      > RETURN                                                   $8
   24    15    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !0
         16      > JMPZ                                                     ~9, ->19
   25    17    >   FETCH_DIM_R                                      ~10     !1, !0
         18      > RETURN                                                   ~10
   27    19    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FiIMA0%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.58 ms | 945 KiB | 22 Q