3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "This is a #hashtag within some #awesometext."; function tagIt($body) { $string = $body; $htag = "#"; $newstring = preg_replace("/#(\w)+/", "<a href='category.php?tag=$1'>#$1</a>", $string); //$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".$newstring."\n"; } tagIt($text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZRp1q
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.'
   26     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 = 62) Position 1 = -2
filename:       /in/ZRp1q
function name:  tagIt
number of ops:  13
compiled vars:  !0 = $body, !1 = $string, !2 = $htag, !3 = $newstring
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_replace'
          4        SEND_VAL                                                 '%2F%23%28%5Cw%29%2B%2F'
          5        SEND_VAL                                                 '%3Ca+href%3D%27category.php%3Ftag%3D%241%27%3E%23%241%3C%2Fa%3E'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !3, $6
   23     9        CONCAT                                           ~8      '%0A', !3
         10        CONCAT                                           ~9      ~8, '%0A'
         11        ECHO                                                     ~9
   24    12      > RETURN                                                   null

End of function tagit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.14 ms | 1397 KiB | 16 Q