3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'lorem ipsum'; $pattern = '/lorem/'; $value = 'test $0'; echo preg_replace($pattern, preg_replace('/\$(\d+)/', '\\\$$1', $value), $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8aps
function name:  (null)
number of ops:  15
compiled vars:  !0 = $text, !1 = $pattern, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'lorem+ipsum'
    3     1        ASSIGN                                                   !1, '%2Florem%2F'
    4     2        ASSIGN                                                   !2, 'test+%240'
    5     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !1
          5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2F%5C%24%28%5Cd%2B%29%2F'
          7        SEND_VAL                                                 '%5C%5C%24%241'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13        ECHO                                                     $7
         14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.49 ms | 1004 KiB | 14 Q