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_walk($surnameKeys, function ($keys) use ($data) { var_dump($keys); if (is_array($keys)) { if (isset($data[$keys[0]])) { echo 'here'; $something[] = array_column($data[$keys[0]], $keys[1]); } } }); // 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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pVf2U
function name:  (null)
number of ops:  13
compiled vars:  !0 = $data, !1 = $surnameKeys, !2 = $something
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   17     2        ASSIGN                                                   !2, <array>
   19     3        INIT_FCALL                                               'array_walk'
          4        SEND_REF                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpVf2U%3A19%240'
          6        BIND_LEXICAL                                             ~6, !0
   28     7        SEND_VAL                                                 ~6
          8        DO_ICALL                                                 
   43     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   46    12      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FpVf2U%3A19%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.66 ms | 1396 KiB | 19 Q