3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "This is a #hashtag within some #awesometext."; function tagIt($body) { $string = $body; $htag = "#"; $arr = preg_split("/(\s|\.|\!)/", $string);print_r($arr); $arrc = count($arr); $i = 0; while($i < $arrc) { if(substr($arr[$i], 0, 1) === $htag) { $arr[$i] = "<a href = 'category.php?tag=".substr($arr[$i], 1)."'>".$arr[$i]."</a>"; } $i++; } $string = implode(" ", $arr); echo "\n".$string."\n"; } tagIt($text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J1pn9
function name:  (null)
number of ops:  5
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+a+%23hashtag+within+some+%23awesometext.'
   25     1        INIT_FCALL                                               'tagit'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function tagit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 15
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 35
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 15
Branch analysis from position: 38
Branch analysis from position: 15
Branch analysis from position: 35
filename:       /in/J1pn9
function name:  tagIt
number of ops:  47
compiled vars:  !0 = $body, !1 = $string, !2 = $htag, !3 = $arr, !4 = $arrc, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, !0
    8     2        ASSIGN                                                   !2, '%23'
    9     3        INIT_FCALL                                               'preg_split'
          4        SEND_VAL                                                 '%2F%28%5Cs%7C%5C.%7C%5C%21%29%2F'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
          8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                                 
   10    11        COUNT                                            ~11     !3
         12        ASSIGN                                                   !4, ~11
   11    13        ASSIGN                                                   !5, 0
   13    14      > JMP                                                      ->36
   14    15    >   INIT_FCALL                                               'substr'
         16        FETCH_DIM_R                                      ~14     !3, !5
         17        SEND_VAL                                                 ~14
         18        SEND_VAL                                                 0
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $15     
         21        IS_IDENTICAL                                             !2, $15
         22      > JMPZ                                                     ~16, ->35
   15    23    >   INIT_FCALL                                               'substr'
         24        FETCH_DIM_R                                      ~18     !3, !5
         25        SEND_VAL                                                 ~18
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $19     
         28        CONCAT                                           ~20     '%3Ca+href+%3D+%27category.php%3Ftag%3D', $19
         29        CONCAT                                           ~21     ~20, '%27%3E'
         30        FETCH_DIM_R                                      ~22     !3, !5
         31        CONCAT                                           ~23     ~21, ~22
         32        CONCAT                                           ~24     ~23, '%3C%2Fa%3E'
         33        ASSIGN_DIM                                               !3, !5
         34        OP_DATA                                                  ~24
   17    35    >   PRE_INC                                                  !5
   13    36    >   IS_SMALLER                                               !5, !4
         37      > JMPNZ                                                    ~26, ->15
   20    38    >   INIT_FCALL                                               'implode'
         39        SEND_VAL                                                 '+'
         40        SEND_VAR                                                 !3
         41        DO_ICALL                                         $27     
         42        ASSIGN                                                   !1, $27
   22    43        CONCAT                                           ~29     '%0A', !1
         44        CONCAT                                           ~30     ~29, '%0A'
         45        ECHO                                                     ~30
   23    46      > RETURN                                                   null

End of function tagit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.79 ms | 1402 KiB | 22 Q