3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gethashtags($text) { //Match the hashtags preg_match_all('/(^|[^a-z0-9_])#([a-z0-9_]+)/i', $text, $matchedHashtags); $hashtag = ''; // For each hashtag, strip all characters but alpha numeric if(!empty($matchedHashtags[0])) { foreach($matchedHashtags[0] as $match) { $hashtag[] = preg_replace("/[^a-z0-9]+/i", "", $match); } } //to remove last comma in a string //return rtrim($hashtag, ','); return $hashtag; } //usage $text = "dfd'fdfd%#df"; print_R(gethashtags($text));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MAN8N
function name:  (null)
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'dfd%27fdfd%25%23df'
   20     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'gethashtags'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function gethashtags:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 22
filename:       /in/MAN8N
function name:  gethashtags
number of ops:  24
compiled vars:  !0 = $text, !1 = $matchedHashtags, !2 = $hashtag, !3 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5E%7C%5B%5Ea-z0-9_%5D%29%23%28%5Ba-z0-9_%5D%2B%29%2Fi'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    7     6        ASSIGN                                                   !2, ''
    9     7        ISSET_ISEMPTY_DIM_OBJ                         1  ~6      !1, 0
          8        BOOL_NOT                                         ~7      ~6
          9      > JMPZ                                                     ~7, ->22
   10    10    >   FETCH_DIM_R                                      ~8      !1, 0
         11      > FE_RESET_R                                       $9      ~8, ->21
         12    > > FE_FETCH_R                                               $9, !3, ->21
   11    13    >   INIT_FCALL                                               'preg_replace'
         14        SEND_VAL                                                 '%2F%5B%5Ea-z0-9%5D%2B%2Fi'
         15        SEND_VAL                                                 ''
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $11     
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  $11
   10    20      > JMP                                                      ->12
         21    >   FE_FREE                                                  $9
   16    22    > > RETURN                                                   !2
   17    23*     > RETURN                                                   null

End of function gethashtags

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.77 ms | 1399 KiB | 20 Q