3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "This is a #hastag within some #awesometext."; function tagIt($body) { $string = $body; $htag = "#"; $arr = preg_split("/\b([^#])/", $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=$arr[$i]'>".$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/0huJ1
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+%23hastag+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 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 15
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 15
Branch analysis from position: 35
Branch analysis from position: 15
Branch analysis from position: 32
filename:       /in/0huJ1
function name:  tagIt
number of ops:  44
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%5Cb%28%5B%5E%23%5D%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                                                      ->33
   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, ->32
   15    23    >   ROPE_INIT                                     3  ~20     '%3Ca+href+%3D+%27category.php%3Ftag%3D'
         24        FETCH_DIM_R                                      ~18     !3, !5
         25        ROPE_ADD                                      1  ~20     ~20, ~18
         26        ROPE_END                                      2  ~19     ~20, '%27%3E'
         27        FETCH_DIM_R                                      ~22     !3, !5
         28        CONCAT                                           ~23     ~19, ~22
         29        CONCAT                                           ~24     ~23, '%3C%2Fa%3E'
         30        ASSIGN_DIM                                               !3, !5
         31        OP_DATA                                                  ~24
   17    32    >   PRE_INC                                                  !5
   13    33    >   IS_SMALLER                                               !5, !4
         34      > JMPNZ                                                    ~26, ->15
   20    35    >   INIT_FCALL                                               'implode'
         36        SEND_VAL                                                 '+'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                         $27     
         39        ASSIGN                                                   !1, $27
   22    40        CONCAT                                           ~29     '%0A', !1
         41        CONCAT                                           ~30     ~29, '%0A'
         42        ECHO                                                     ~30
   23    43      > RETURN                                                   null

End of function tagit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.33 ms | 1403 KiB | 22 Q