3v4l.org

run code in 300+ PHP versions simultaneously
<?php $args = [ 'a' => [ 'zebra' => 1, ], 'b' => [ 'zebra' => 0, ], 'c' => [ 'zebra' => 1, ], 'd' => [ 'zebra' => 1, ], 'e' => [ 'zebra' => 1, ], ]; $args0 = array_filter($args, function ($arg) { return $arg['zebra'] === 0; }); $args1 = array_filter($args, function ($arg) { return $arg['zebra'] === 1; }); $result = array_merge(...array_map(static function ($arg0Key, $arg1Key) use ($args0, $args1) { if ($arg0Key !== null) { $result[$arg0Key] = $args0[$arg0Key]; } if ($arg1Key !== null) { $result[$arg1Key] = $args1[$arg1Key]; } return $result; }, array_keys($args0), array_keys($args1))); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sfqeq
function name:  (null)
number of ops:  36
compiled vars:  !0 = $args, !1 = $args0, !2 = $args1, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   22     4        SEND_VAL                                                 ~5
   20     5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !1, $6
   23     7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !0
          9        DECLARE_LAMBDA_FUNCTION                          ~8      [1]
   25    10        SEND_VAL                                                 ~8
   23    11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !2, $9
   27    13        INIT_FCALL                                               'array_merge'
         14        INIT_FCALL                                               'array_map'
         15        DECLARE_LAMBDA_FUNCTION                          ~11     [2]
         16        BIND_LEXICAL                                             ~11, !1
         17        BIND_LEXICAL                                             ~11, !2
   35    18        SEND_VAL                                                 ~11
         19        INIT_FCALL                                               'array_keys'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $12     
         22        SEND_VAR                                                 $12
         23        INIT_FCALL                                               'array_keys'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $13     
         26        SEND_VAR                                                 $13
   27    27        DO_ICALL                                         $14     
   35    28        SEND_UNPACK                                              $14
         29        CHECK_UNDEF_ARGS                                         
   27    30        DO_ICALL                                         $15     
         31        ASSIGN                                                   !3, $15
   37    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
         35      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sfqeq
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        FETCH_DIM_R                                      ~1      !0, 'zebra'
          2        IS_IDENTICAL                                     ~2      ~1, 0
          3      > RETURN                                                   ~2
   22     4*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sfqeq
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        FETCH_DIM_R                                      ~1      !0, 'zebra'
          2        IS_IDENTICAL                                     ~2      ~1, 1
          3      > RETURN                                                   ~2
   25     4*     > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/sfqeq
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $arg0Key, !1 = $arg1Key, !2 = $args0, !3 = $args1, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   28     4        TYPE_CHECK                                  1020          !0
          5      > JMPZ                                                     ~5, ->9
   29     6    >   FETCH_DIM_R                                      ~7      !2, !0
          7        ASSIGN_DIM                                               !4, !0
          8        OP_DATA                                                  ~7
   31     9    >   TYPE_CHECK                                  1020          !1
         10      > JMPZ                                                     ~8, ->14
   32    11    >   FETCH_DIM_R                                      ~10     !3, !1
         12        ASSIGN_DIM                                               !4, !1
         13        OP_DATA                                                  ~10
   34    14    > > RETURN                                                   !4
   35    15*     > RETURN                                                   null

End of Dynamic Function 2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.96 ms | 1020 KiB | 18 Q