3v4l.org

run code in 500+ PHP versions simultaneously
<?php $usr = (object)[ 'interests' => 'Cats,Dogs,Monkeys,Praying Mantises,Octopuses,Arowanas,Sloths,Tasmanian Tigers' ]; $showMax = 3; printf( 'Interested in: %s', preg_replace_callback_array( [ '/([^,]+)(,)?/' => fn($m) => '<span>' . $m[1] . '</span>' . (isset($m[2]) ? ', ' : ''), '/, [^<].*/' => fn($m) => ' (+' . substr_count($m[0], ',') . ')' ], $usr->interests, $showMax ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5RgPm
function name:  (null)
number of ops:  18
compiled vars:  !0 = $usr, !1 = $showMax
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   CAST                                              8  ~2      <array>
    3     1        ASSIGN                                                       !0, ~2
    6     2        ASSIGN                                                       !1, 3
    8     3        INIT_FCALL                                                   'printf'
    9     4        SEND_VAL                                                     'Interested+in%3A+%25s'
   10     5        INIT_FCALL                                                   'preg_replace_callback_array'
   12     6        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          7        INIT_ARRAY                                           ~6      ~5, '%2F%28%5B%5E%2C%5D%2B%29%28%2C%29%3F%2F'
   13     8        DECLARE_LAMBDA_FUNCTION                              ~7      [1]
   14     9        ADD_ARRAY_ELEMENT                                    ~6      ~7, '%2F%2C+%5B%5E%3C%5D.%2A%2F'
         10        SEND_VAL                                                     ~6
   15    11        FETCH_OBJ_R                                          ~8      !0, 'interests'
         12        SEND_VAL                                                     ~8
   16    13        SEND_VAR                                                     !1
   10    14        DO_ICALL                                             $9      
   16    15        SEND_VAR                                                     $9
    8    16        DO_ICALL                                                     
   18    17      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5RgPm
function name:  {closure:/in/5RgPm:12}
number of ops:  12
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
          1        FETCH_DIM_R                                          ~1      !0, 1
          2        CONCAT                                               ~2      '%3Cspan%3E', ~1
          3        CONCAT                                               ~3      ~2, '%3C%2Fspan%3E'
          4        ISSET_ISEMPTY_DIM_OBJ                             0          !0, 2
          5      > JMPZ                                                         ~4, ->8
          6    >   QM_ASSIGN                                            ~5      '%2C+'
          7      > JMP                                                          ->9
          8    >   QM_ASSIGN                                            ~5      ''
          9    >   CONCAT                                               ~6      ~3, ~5
         10      > RETURN                                                       ~6
         11*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5RgPm
function name:  {closure:/in/5RgPm:13}
number of ops:  10
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'substr_count'
          2        FETCH_DIM_R                                          ~1      !0, 0
          3        SEND_VAL                                                     ~1
          4        SEND_VAL                                                     '%2C'
          5        DO_ICALL                                             $2      
          6        CONCAT                                               ~3      '+%28%2B', $2
          7        CONCAT                                               ~4      ~3, '%29'
          8      > RETURN                                                       ~4
   14     9*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.82 ms | 1462 KiB | 16 Q