3v4l.org

run code in 300+ PHP versions simultaneously
<?php $id = '9242'; $supergroup = array('9242' => 1, '9243' => 0, '9244' => 2, '9245' => 0); $supergroupnew = []; array_walk_recursive($supergroup, function($item, $key) use(&$id) { if ($key == $id) { $supergroupnew += [ $key => $item ]; } else { $supergroupnew += [ $key => "0" ]; } }); echo "<h1>Original Array:</h1>"; print_r($supergroup); echo "<h1>New Array:</h1>"; print_r($supergroupnew);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8Nmg
function name:  (null)
number of ops:  18
compiled vars:  !0 = $id, !1 = $supergroup, !2 = $supergroupnew
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '9242'
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, <array>
    6     3        INIT_FCALL                                               'array_walk_recursive'
          4        SEND_REF                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJ8Nmg%3A6%240'
          6        BIND_LEXICAL                                             ~6, !0
   12     7        SEND_VAL                                                 ~6
          8        DO_ICALL                                                 
   14     9        ECHO                                                     '%3Ch1%3EOriginal+Array%3A%3C%2Fh1%3E'
   15    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   17    13        ECHO                                                     '%3Ch1%3ENew+Array%3A%3C%2Fh1%3E'
   18    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FJ8Nmg%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8Nmg
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $item, !1 = $key, !2 = $id, !3 = $supergroupnew
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        IS_EQUAL                                                 !1, !2
          4      > JMPZ                                                     ~4, ->8
    8     5    >   INIT_ARRAY                                       ~5      !0, !1
          6        ASSIGN_OP                                     1          !3, ~5
          7      > JMP                                                      ->10
   10     8    >   INIT_ARRAY                                       ~7      '0', !1
          9        ASSIGN_OP                                     1          !3, ~7
   12    10    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJ8Nmg%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.26 ms | 1396 KiB | 17 Q