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); $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/Ob314
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 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 12
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 12
Branch analysis from position: 32
Branch analysis from position: 12
Branch analysis from position: 29
filename:       /in/Ob314
function name:  tagIt
number of ops:  41
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%21%23%2F'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
   10     8        COUNT                                            ~10     !3
          9        ASSIGN                                                   !4, ~10
   11    10        ASSIGN                                                   !5, 0
   13    11      > JMP                                                      ->30
   14    12    >   INIT_FCALL                                               'substr'
         13        FETCH_DIM_R                                      ~13     !3, !5
         14        SEND_VAL                                                 ~13
         15        SEND_VAL                                                 0
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $14     
         18        IS_IDENTICAL                                             !2, $14
         19      > JMPZ                                                     ~15, ->29
   15    20    >   ROPE_INIT                                     3  ~19     '%3Ca+href+%3D+%27category.php%3Ftag%3D'
         21        FETCH_DIM_R                                      ~17     !3, !5
         22        ROPE_ADD                                      1  ~19     ~19, ~17
         23        ROPE_END                                      2  ~18     ~19, '%27%3E'
         24        FETCH_DIM_R                                      ~21     !3, !5
         25        CONCAT                                           ~22     ~18, ~21
         26        CONCAT                                           ~23     ~22, '%3C%2Fa%3E'
         27        ASSIGN_DIM                                               !3, !5
         28        OP_DATA                                                  ~23
   17    29    >   PRE_INC                                                  !5
   13    30    >   IS_SMALLER                                               !5, !4
         31      > JMPNZ                                                    ~25, ->12
   20    32    >   INIT_FCALL                                               'implode'
         33        SEND_VAL                                                 '+'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                         $26     
         36        ASSIGN                                                   !1, $26
   22    37        CONCAT                                           ~28     '%0A', !1
         38        CONCAT                                           ~29     ~28, '%0A'
         39        ECHO                                                     ~29
   23    40      > RETURN                                                   null

End of function tagit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.32 ms | 1402 KiB | 20 Q