3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = 'quick, brown" (for example), but not "quick and brown". So whe'; $test = "QUICK BROWN"; $temp = explode(" ", $test); $temp = array_map(function ($val) { return preg_quote($val, "~");}, $temp); $pattern = '~('.implode("[^A-Za-z0-9]+", $temp).')~i'; echo preg_replace( $pattern , '<span class="hilite">$1</span>', $source );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/feEF3
function name:  (null)
number of ops:  27
compiled vars:  !0 = $source, !1 = $test, !2 = $temp, !3 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'quick%2C+brown%22+%28for+example%29%2C+but+not+%22quick+and+brown%22.+So+whe'
    5     1        ASSIGN                                                   !1, 'QUICK+BROWN'
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
    7     7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfeEF3%3A7%240'
          9        SEND_VAL                                                 ~8
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !2, $9
    8    13        INIT_FCALL                                               'implode'
         14        SEND_VAL                                                 '%5B%5EA-Za-z0-9%5D%2B'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $11     
         17        CONCAT                                           ~12     '%7E%28', $11
         18        CONCAT                                           ~13     ~12, '%29%7Ei'
         19        ASSIGN                                                   !3, ~13
    9    20        INIT_FCALL                                               'preg_replace'
         21        SEND_VAR                                                 !3
         22        SEND_VAL                                                 '%3Cspan+class%3D%22hilite%22%3E%241%3C%2Fspan%3E'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $15     
         25        ECHO                                                     $15
         26      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfeEF3%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/feEF3
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'preg_quote'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%7E'
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfeEF3%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.31 ms | 1396 KiB | 23 Q