3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Function to create a dynamic replacement. * @param array $match An array with the match of the pattern. * @return string The replacement. */ function getReplacement($match) { if (isset($match[0])) { return $match[0].'<br/>'; } } //the value to replace specific parts. $string = 'Tip #1 some #12 random #123 text #1234, an #12345 example #123456'; //replace all parts starting with '#' and three numbers following. echo preg_replace_callback('/#[0-9]+/', 'getReplacement', $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNmkj
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 'Tip+%231+some+%2312+random+%23123+text+%231234%2C+an+%2312345+example+%23123456'
   18     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%23%5B0-9%5D%2B%2F'
          3        SEND_VAL                                                 'getReplacement'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Function getreplacement:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNmkj
function name:  getReplacement
number of ops:  7
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 0
          2      > JMPZ                                                     ~1, ->6
   10     3    >   FETCH_DIM_R                                      ~2      !0, 0
          4        CONCAT                                           ~3      ~2, '%3Cbr%2F%3E'
          5      > RETURN                                                   ~3
   12     6    > > RETURN                                                   null

End of function getreplacement

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.2 ms | 1405 KiB | 15 Q