3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replace_text($text) { return preg_replace('/(?<!\\\\)`((?:[^`\\\\]|\\\\.)*)`/', '<code>$1</code>', $text); } $text = 'some words \` and `some code` and `some \`more code` again'; echo replace_text($text); $text = '`some words \ and `'; echo replace_text($text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ck0co
function name:  (null)
number of ops:  11
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'some+words+%5C%60+and+%60some+code%60+and+%60some+%5C%60more+code%60+again'
    8     1        INIT_FCALL                                               'replace_text'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   10     5        ASSIGN                                                   !0, '%60some+words+%5C+and+%60'
   11     6        INIT_FCALL                                               'replace_text'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
         10      > RETURN                                                   1

Function replace_text:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ck0co
function name:  replace_text
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%28%3F%3C%21%5C%5C%29%60%28%28%3F%3A%5B%5E%60%5C%5C%5D%7C%5C%5C.%29%2A%29%60%2F'
          3        SEND_VAL                                                 '%3Ccode%3E%241%3C%2Fcode%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    5     7*     > RETURN                                                   null

End of function replace_text

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.39 ms | 1012 KiB | 16 Q