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]])) { var_dump($data[$keys[0]]); $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/NmUYP
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%2FNmUYP%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%2FNmUYP%3A19%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 24
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 24
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 24
filename:       /in/NmUYP
function name:  {closure}
number of ops:  25
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, ->24
   23     7    >   FETCH_DIM_R                                      ~5      !0, 0
          8        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~5
          9      > JMPZ                                                     ~6, ->24
   24    10    >   INIT_FCALL                                               'var_dump'
         11        FETCH_DIM_R                                      ~7      !0, 0
         12        FETCH_DIM_R                                      ~8      !1, ~7
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                                 
   25    15        INIT_FCALL                                               'array_column'
         16        FETCH_DIM_R                                      ~11     !0, 0
         17        FETCH_DIM_R                                      ~12     !1, ~11
         18        SEND_VAL                                                 ~12
         19        FETCH_DIM_R                                      ~13     !0, 1
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        ASSIGN_DIM                                               !2
         23        OP_DATA                                                  $14
   28    24    > > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.39 ms | 1400 KiB | 19 Q