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.'; $loops = 0; $callback = function($match) use(&$loops) { return ++$loops <= 3 ? $match[0] : ' '; }; echo "BEFORE : ", $message, "\n"; echo "AFTER : ", preg_replace_callback('~\h*#[a-z]+\h*~i', $callback, $message), "\n"; echo "LOOPS : ", $loops, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2G0cI
function name:  (null)
number of ops:  20
compiled vars:  !0 = $message, !1 = $loops, !2 = $callback
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        ASSIGN                                                   !1, 0
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2G0cI%3A5%240'
          3        BIND_LEXICAL                                             ~5, !1
          4        ASSIGN                                                   !2, ~5
    8     5        ECHO                                                     'BEFORE+%3A+'
          6        ECHO                                                     !0
          7        ECHO                                                     '%0A'
    9     8        ECHO                                                     'AFTER++%3A+'
          9        INIT_FCALL                                               'preg_replace_callback'
         10        SEND_VAL                                                 '%7E%5Ch%2A%23%5Ba-z%5D%2B%5Ch%2A%7Ei'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        ECHO                                                     $7
         15        ECHO                                                     '%0A'
   10    16        ECHO                                                     'LOOPS++%3A+'
         17        ECHO                                                     !1
         18        ECHO                                                     '%0A'
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F2G0cI%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
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/2G0cI
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $match, !1 = $loops
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2        PRE_INC                                          ~2      !1
          3        IS_SMALLER_OR_EQUAL                                      ~2, 3
          4      > JMPZ                                                     ~3, ->8
          5    >   FETCH_DIM_R                                      ~4      !0, 0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      '+'
          9    > > RETURN                                                   ~5
    7    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2G0cI%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.12 ms | 1396 KiB | 15 Q