3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/((?<!\w)#\w+)/i'; $subject = <<<EOT Blablalb #toto zdjsdf #ho_yeah EOT; $hashtags = []; $result = preg_replace_callback('/(\s#\w+)/i', function ($matches) use (&$hashtags) { var_dump($matches); $hashtags[] = trim($matches[0]); return ''; }, $subject); var_dump($result, $hashtags);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9r6rJ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $pattern, !1 = $subject, !2 = $hashtags, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%2F%28%28%3F%3C%21%5Cw%29%23%5Cw%2B%29%2Fi'
    5     1        ASSIGN                                                   !1, 'Blablalb+%23toto+zdjsdf+%23ho_yeah'
    8     2        ASSIGN                                                   !2, <array>
   10     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%2F%28%5Cs%23%5Cw%2B%29%2Fi'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9r6rJ%3A10%240'
          6        BIND_LEXICAL                                             ~7, !2
   14     7        SEND_VAL                                                 ~7
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $8      
   10    10        ASSIGN                                                   !3, $8
   17    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9r6rJ%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9r6rJ
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $matches, !1 = $hashtags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'trim'
          6        FETCH_DIM_R                                      ~4      !0, 0
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  $5
   13    11      > RETURN                                                   ''
   14    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9r6rJ%3A10%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.14 ms | 1396 KiB | 19 Q