3v4l.org

run code in 300+ PHP versions simultaneously
<?php function highlightWords($content) { $arr=array("php", "and sql", "sql"); $arr = array_map(function($v){ return "/\b(" . preg_quote($v, "/") . ")\b/i"; }, $arr); print_r($arr); $content=preg_replace($arr, '<a href="#">$1</a>', $content, 1); return $content; } echo highlightWords("This text will highlight PHP and SQL and sql but not PHPRO or MySQL or sqlite");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rAcM1
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'highlightwords'
          1        SEND_VAL                                                 'This+text+will+highlight+PHP+and+SQL+and+sql+but+not+PHPRO+or+MySQL+or+sqlite'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function highlightwords:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rAcM1
function name:  highlightWords
number of ops:  20
compiled vars:  !0 = $content, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrAcM1%3A6%240'
    8     4        SEND_VAL                                                 ~3
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
    6     7        ASSIGN                                                   !1, $4
    9     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'preg_replace'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 '%3Ca+href%3D%22%23%22%3E%241%3C%2Fa%3E'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !0, $7
   12    18      > RETURN                                                   !0
   13    19*     > RETURN                                                   null

End of function highlightwords

Function %00%7Bclosure%7D%2Fin%2FrAcM1%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rAcM1
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'preg_quote'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                         $1      
          5        CONCAT                                           ~2      '%2F%5Cb%28', $1
          6        CONCAT                                           ~3      ~2, '%29%5Cb%2Fi'
          7      > RETURN                                                   ~3
    8     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrAcM1%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.1 ms | 1403 KiB | 22 Q