3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = array( 'Bag' => 'Cart', 'Cart' => 'Bag', ); $strings = 'Bag Cart Cart Bag Miscellaneous'; $strings = implode(" ", array_map(fn($v) => $text[$v] ?? $v, explode(" ", $strings))); echo $strings;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Lstp0
function name:  (null)
number of ops:  19
compiled vars:  !0 = $text, !1 = $strings
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, 'Bag+Cart+Cart+Bag+Miscellaneous'
   10     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '+'
          4        INIT_FCALL                                               'array_map'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        BIND_LEXICAL                                             ~4, !0
          7        SEND_VAL                                                 ~4
          8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '+'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !1, $7
   12    17        ECHO                                                     !1
   13    18      > 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/Lstp0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_IS                                     ~2      !1, !0
          3        COALESCE                                         ~3      ~2
          4        QM_ASSIGN                                        ~3      !0
          5      > RETURN                                                   ~3
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.54 ms | 1447 KiB | 16 Q