3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "Samsung Television 21 Television new"; $syns = [ 'tv' => ['sdds', 'Television new', 'Television11'] ]; $str1 = array_reduce(array_keys($syns), function($c, $x) use ($syns) { return $c = preg_replace('/\b'.join('\b|\b', $syns[$x]).'\b/', $x, $c); }, $str1); $arr1 = explode(' ', $str1); var_dump($arr1); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YhO4V
function name:  (null)
number of ops:  22
compiled vars:  !0 = $str1, !1 = $syns, !2 = $arr1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'Samsung+Television+21+Television+new'
    9     1        ASSIGN                                                   !1, <array>
   14     2        INIT_FCALL                                               'array_reduce'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYhO4V%3A14%240'
          8        BIND_LEXICAL                                             ~6, !1
   18     9        SEND_VAL                                                 ~6
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
   14    12        ASSIGN                                                   !0, $7
   23    13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '+'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !2, $9
   25    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
   27    21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FYhO4V%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YhO4V
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $c, !1 = $x, !2 = $syns
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   16     3        INIT_FCALL                                               'preg_replace'
          4        INIT_FCALL                                               'join'
          5        SEND_VAL                                                 '%5Cb%7C%5Cb'
          6        FETCH_DIM_R                                      ~3      !2, !1
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      '%2F%5Cb', $4
         10        CONCAT                                           ~6      ~5, '%5Cb%2F'
         11        SEND_VAL                                                 ~6
         12        SEND_VAR                                                 !1
   17    13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $7      
   16    15        ASSIGN                                           ~8      !0, $7
         16      > RETURN                                                   ~8
   18    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYhO4V%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.76 ms | 1400 KiB | 25 Q