3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = 'What will happen to the #globe if there is more #sunlight more #moonlight but less overall #light. Ah! Funny little #joke. Goodbye fellas!!! #Morning Jokes #For No one.'; $GLOBALS['_loops'] = 0; function replace_hashes($match) { var_dump($match); return ++$GLOBALS['_loops'] <= 3 ? $match[0] : ' '; } echo "BEFORE : ", $message, "\n"; echo "AFTER : ", preg_replace_callback('~\h*#[a-z]+\h*~i', 'replace_hashes', $message), "\n"; echo "LOOPS : ", $GLOBALS['_loops'], "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sNkBa
function name:  (null)
number of ops:  21
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'What+will+happen+to+the+%23globe+if+there+is+more+%23sunlight+more+%23moonlight+but+less+overall+%23light.+Ah%21+Funny+little+%23joke.+Goodbye+fellas%21%21%21+%23Morning+Jokes+%23For+No+one.'
    4     1        FETCH_W                      global              $2      'GLOBALS'
          2        ASSIGN_DIM                                               $2, '_loops'
          3        OP_DATA                                                  0
    9     4        ECHO                                                     'BEFORE+%3A+'
          5        ECHO                                                     !0
          6        ECHO                                                     '%0A'
   10     7        ECHO                                                     'AFTER++%3A+'
          8        INIT_FCALL                                               'preg_replace_callback'
          9        SEND_VAL                                                 '%7E%5Ch%2A%23%5Ba-z%5D%2B%5Ch%2A%7Ei'
         10        SEND_VAL                                                 'replace_hashes'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $4      
         13        ECHO                                                     $4
         14        ECHO                                                     '%0A'
   11    15        ECHO                                                     'LOOPS++%3A+'
         16        FETCH_R                      global              ~5      'GLOBALS'
         17        FETCH_DIM_R                                      ~6      ~5, '_loops'
         18        ECHO                                                     ~6
         19        ECHO                                                     '%0A'
         20      > RETURN                                                   1

Function replace_hashes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sNkBa
function name:  replace_hashes
number of ops:  15
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4        FETCH_RW                     global              $2      'GLOBALS'
          5        FETCH_DIM_RW                                     $3      $2, '_loops'
          6        PRE_INC                                          ~4      $3
          7        IS_SMALLER_OR_EQUAL                                      ~4, 3
          8      > JMPZ                                                     ~5, ->12
          9    >   FETCH_DIM_R                                      ~6      !0, 0
         10        QM_ASSIGN                                        ~7      ~6
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      '+'
         13    > > RETURN                                                   ~7
    8    14*     > RETURN                                                   null

End of function replace_hashes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.66 ms | 1400 KiB | 17 Q