3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 'a' => 'food', 'b' => 'foo', 'c' => 'goo', 'd' => 'foo', 'e' => 'good' ]; $needle = 'foo'; $newValue = 'bar'; var_export( array_map(fn($v) => $v === $needle ? $newValue : $v, $array) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qOi1t
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $needle, !2 = $newValue
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, 'foo'
   12     2        ASSIGN                                                       !2, 'bar'
   14     3        INIT_FCALL                                                   'var_export'
   15     4        INIT_FCALL                                                   'array_map'
          5        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
          6        BIND_LEXICAL                                                 ~6, !1
          7        BIND_LEXICAL                                                 ~6, !2
          8        SEND_VAL                                                     ~6
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $7      
         11        SEND_VAR                                                     $7
   14    12        DO_ICALL                                                     
   16    13      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qOi1t
function name:  {closure:/in/qOi1t:15}
number of ops:  10
compiled vars:  !0 = $v, !1 = $needle, !2 = $newValue
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        BIND_STATIC                                                  !2
          3        IS_IDENTICAL                                                 !0, !1
          4      > JMPZ                                                         ~3, ->7
          5    >   QM_ASSIGN                                            ~4      !2
          6      > JMP                                                          ->8
          7    >   QM_ASSIGN                                            ~4      !0
          8    > > RETURN                                                       ~4
          9*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.51 ms | 1724 KiB | 15 Q