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(&$hastags) { $hashtags[] = trim($matches[0]); return ''; }, $subject); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dd3Ci
function name:  (null)
number of ops:  15
compiled vars:  !0 = $pattern, !1 = $subject, !2 = $hashtags, !3 = $result, !4 = $hastags
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%2FDd3Ci%3A10%240'
          6        BIND_LEXICAL                                             ~8, !4
   13     7        SEND_VAL                                                 ~8
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $9      
   10    10        ASSIGN                                                   !3, $9
   16    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.78 ms | 1396 KiB | 19 Q