3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bold($word, $sentence){ $result = preg_replace('~\b(' . preg_quote($word, '~') . ')\b~i', '<span class="found">$1</span>', $sentence); return $result; } $query = 'google'; $description = 'google this and that okay'; $thing = bolder($query, $description); echo $thing;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HKgvX
function name:  (null)
number of ops:  9
compiled vars:  !0 = $query, !1 = $description, !2 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'google'
    8     1        ASSIGN                                                   !1, 'google+this+and+that+okay'
    9     2        INIT_FCALL_BY_NAME                                       'bolder'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   10     7        ECHO                                                     !2
          8      > RETURN                                                   1

Function bold:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HKgvX
function name:  bold
number of ops:  16
compiled vars:  !0 = $word, !1 = $sentence, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'preg_replace'
          3        INIT_FCALL                                               'preg_quote'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 '%7E'
          6        DO_ICALL                                         $3      
          7        CONCAT                                           ~4      '%7E%5Cb%28', $3
          8        CONCAT                                           ~5      ~4, '%29%5Cb%7Ei'
          9        SEND_VAL                                                 ~5
         10        SEND_VAL                                                 '%3Cspan+class%3D%22found%22%3E%241%3C%2Fspan%3E'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $6      
         13        ASSIGN                                                   !2, $6
    4    14      > RETURN                                                   !2
    5    15*     > RETURN                                                   null

End of function bold

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.33 ms | 1400 KiB | 17 Q