3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ( array( array('/\\d+/', '$0'), array('/\\d+/', '$01'), array('/\\d+/', '$001'), array('/\\d+/', '${0}1'), array('/(\\d+)/', '$0'), array('/(\\d+)/', '$01'), array('/(\\d+)/', '{$0}1'), array('/(\\d+)/', '$1'), array('/(\\d+)/', '$12'), array('/(\\d+)/', '$012'), array('/(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\\d+)/', '$12'), array('/(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\\d+)/', '$123'), ) as $list ) { list ($re, $replace) = $list; echo "$re '$replace' => '", preg_replace($re, $replace, "42"), "'\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 21
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/kBsQd
function name:  (null)
number of ops:  23
compiled vars:  !0 = $list, !1 = $re, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > FE_RESET_R                                       $3      <array>, ->21
          1    > > FE_FETCH_R                                               $3, !0, ->21
   19     2    >   QM_ASSIGN                                        ~4      !0
          3        FETCH_LIST_R                                     $5      ~4, 0
          4        ASSIGN                                                   !1, $5
          5        FETCH_LIST_R                                     $7      ~4, 1
          6        ASSIGN                                                   !2, $7
          7        FREE                                                     ~4
   20     8        ROPE_INIT                                     4  ~10     !1
          9        ROPE_ADD                                      1  ~10     ~10, '++%27'
         10        ROPE_ADD                                      2  ~10     ~10, !2
         11        ROPE_END                                      3  ~9      ~10, '%27+%3D%3E+%27'
         12        ECHO                                                     ~9
         13        INIT_FCALL                                               'preg_replace'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !2
         16        SEND_VAL                                                 '42'
         17        DO_ICALL                                         $12     
         18        ECHO                                                     $12
         19        ECHO                                                     '%27%0A'
    4    20      > JMP                                                      ->1
         21    >   FE_FREE                                                  $3
   21    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.57 ms | 1395 KiB | 15 Q