3v4l.org

run code in 500+ 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                              ~6      [0]
          8        BIND_LEXICAL                                                 ~6, !1
   18     9        SEND_VAL                                                     ~6
         10        SEND_VAR                                                     !0
   14    11        DO_ICALL                                             $7      
         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


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YhO4V
function name:  {closure:/in/YhO4V:14}
number of ops:  15
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                                                   'join'
          4        SEND_VAL                                                     '%5Cb%7C%5Cb'
          5        FETCH_DIM_R                                          ~3      !2, !1
          6        SEND_VAL                                                     ~3
          7        DO_ICALL                                             $4      
          8        CONCAT                                               ~5      '%2F%5Cb', $4
          9        CONCAT                                               ~6      ~5, '%5Cb%2F'
         10        FRAMELESS_ICALL_3                preg_replace        ~7      ~6, !1
   17    11        OP_DATA                                                      !0
   16    12        ASSIGN                                               ~8      !0, ~7
         13      > RETURN                                                       ~8
   18    14*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.54 ms | 2119 KiB | 13 Q