3v4l.org

run code in 300+ PHP versions simultaneously
<?php $colours = array("Red", "Blue", "Green"); $string = "There are three Red and Green walls."; echo preg_replace("/\b(?:" . implode('|', $colours) . ")\b/", '%1%$0%2%', $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9077N
function name:  (null)
number of ops:  15
compiled vars:  !0 = $colours, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'There+are+three+Red+and+Green+walls.'
    6     2        INIT_FCALL                                               'preg_replace'
          3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%7C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        CONCAT                                           ~5      '%2F%5Cb%28%3F%3A', $4
          8        CONCAT                                           ~6      ~5, '%29%5Cb%2F'
          9        SEND_VAL                                                 ~6
         10        SEND_VAL                                                 '%251%25%240%252%25'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        ECHO                                                     $7
         14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.38 ms | 1010 KiB | 15 Q