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; echo "BEFORE : ", $message, "\n"; echo "AFTER : ", preg_replace_callback('~\h*#[a-z]+\h*~i', function($match) { return ++$GLOBALS['_loops'] <= 3 ? $match[0] : ' '; }, $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/tSpIm
function name:  (null)
number of ops:  22
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
    5     4        ECHO                                                     'BEFORE+%3A+'
          5        ECHO                                                     !0
          6        ECHO                                                     '%0A'
    6     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        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtSpIm%3A6%240'
         11        SEND_VAL                                                 ~4
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $5      
         14        ECHO                                                     $5
         15        ECHO                                                     '%0A'
    7    16        ECHO                                                     'LOOPS++%3A+'
         17        FETCH_R                      global              ~6      'GLOBALS'
         18        FETCH_DIM_R                                      ~7      ~6, '_loops'
         19        ECHO                                                     ~7
         20        ECHO                                                     '%0A'
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtSpIm%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tSpIm
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        FETCH_RW                     global              $1      'GLOBALS'
          2        FETCH_DIM_RW                                     $2      $1, '_loops'
          3        PRE_INC                                          ~3      $2
          4        IS_SMALLER_OR_EQUAL                                      ~3, 3
          5      > JMPZ                                                     ~4, ->9
          6    >   FETCH_DIM_R                                      ~5      !0, 0
          7        QM_ASSIGN                                        ~6      ~5
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~6      '+'
         10    > > RETURN                                                   ~6
         11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtSpIm%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.01 ms | 1400 KiB | 15 Q