3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { static function myFunction($arg) { return "[Hello, {$arg[1]}]"; } } $content = 'Lorem ipsum {shortcode 42} dolor sit amet.'; echo preg_replace_callback('/\{shortcode (\d+)\}/i', 'MyClass::myFunction', $content);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SjkDu
function name:  (null)
number of ops:  8
compiled vars:  !0 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, 'Lorem+ipsum+%7Bshortcode+42%7D+dolor+sit+amet.'
   10     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%5C%7Bshortcode+%28%5Cd%2B%29%5C%7D%2Fi'
          3        SEND_VAL                                                 'MyClass%3A%3AmyFunction'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Class MyClass:
Function myfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SjkDu
function name:  myFunction
number of ops:  7
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ROPE_INIT                                     3  ~3      '%5BHello%2C+'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        ROPE_ADD                                      1  ~3      ~3, ~1
          4        ROPE_END                                      2  ~2      ~3, '%5D'
          5      > RETURN                                                   ~2
    6     6*     > RETURN                                                   null

End of function myfunction

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
286.61 ms | 1010 KiB | 14 Q