3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * DO NOT USE IN PRODUCTION */ function link_urls( $str ) { $linked = ''; $words = explode( ' ', $str ); foreach ( $words as &$word ) { if ( false === strpos( $word, '://' ) ) { continue; } $last_char = mb_substr( $word, -1 ); preg_match( '/[^a-zA-Z0-9\/]/', $last_char, $match ); $extra = ( $match ) ? $last_char : ''; $word = sprintf( '<a href="%1$s">%1$s</a>%2$s', ( '' === $extra ) ? $word : mb_substr( $word, 0, -1 ), $extra ); } return implode( ' ', $words ); } // Not this, keep scrolling. $body = <<<EOD Hello, This is the body of the email. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/index.php. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/index.php?why=whoknows. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com:80. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/#welcome. No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/! No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/- No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/? No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/: No further action is needed on your part. Howdy! Some plugins and themes have automatically updated to their latest versions on your site at http://example.com/; No further action is needed on your part. Regards, Email Service EOD; echo link_urls( $body );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/39kOS
function name:  (null)
number of ops:  6
compiled vars:  !0 = $body
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN                                                   !0, 'Hello%2C%0A%0AThis+is+the+body+of+the+email.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2Findex.php.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2Findex.php%3Fwhy%3Dwhoknows.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%3A80.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F%23welcome.+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F%21+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F-+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F%3F+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F%3A+No+further+action+is+needed+on+your+part.%0A%0AHowdy%21+Some+plugins+and+themes+have+automatically+updated+to+their+latest+versions+on+your+site+at+http%3A%2F%2Fexample.com%2F%3B+No+further+action+is+needed+on+your+part.%0A%0ARegards%2C%0AEmail+Service%0A'
   63     1        INIT_FCALL                                               'link_urls'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function link_urls:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 48
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 48
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/39kOS
function name:  link_urls
number of ops:  55
compiled vars:  !0 = $str, !1 = $linked, !2 = $words, !3 = $word, !4 = $last_char, !5 = $match, !6 = $extra
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, ''
    9     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
   10     7      > FE_RESET_RW                                      $10     !2, ->48
          8    > > FE_FETCH_RW                                              $10, !3, ->48
   11     9    >   INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !3
         11        SEND_VAL                                                 '%3A%2F%2F'
         12        DO_ICALL                                         $11     
         13        TYPE_CHECK                                    4          $11
         14      > JMPZ                                                     ~12, ->16
   12    15    > > JMP                                                      ->8
   15    16    >   INIT_FCALL                                               'mb_substr'
         17        SEND_VAR                                                 !3
         18        SEND_VAL                                                 -1
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !4, $13
   17    21        INIT_FCALL                                               'preg_match'
         22        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%5C%2F%5D%2F'
         23        SEND_VAR                                                 !4
         24        SEND_REF                                                 !5
         25        DO_ICALL                                                 
   18    26      > JMPZ                                                     !5, ->29
         27    >   QM_ASSIGN                                        ~16     !4
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~16     ''
         30    >   ASSIGN                                                   !6, ~16
   20    31        INIT_FCALL                                               'sprintf'
   21    32        SEND_VAL                                                 '%3Ca+href%3D%22%251%24s%22%3E%251%24s%3C%2Fa%3E%252%24s'
   22    33        IS_IDENTICAL                                             !6, ''
         34      > JMPZ                                                     ~18, ->37
         35    >   QM_ASSIGN                                        ~19     !3
         36      > JMP                                                      ->43
         37    >   INIT_FCALL                                               'mb_substr'
         38        SEND_VAR                                                 !3
         39        SEND_VAL                                                 0
         40        SEND_VAL                                                 -1
         41        DO_ICALL                                         $20     
         42        QM_ASSIGN                                        ~19     $20
         43    >   SEND_VAL                                                 ~19
   23    44        SEND_VAR                                                 !6
   20    45        DO_ICALL                                         $21     
         46        ASSIGN                                                   !3, $21
   10    47      > JMP                                                      ->8
         48    >   FE_FREE                                                  $10
   27    49        INIT_FCALL                                               'implode'
         50        SEND_VAL                                                 '+'
         51        SEND_VAR                                                 !2
         52        DO_ICALL                                         $23     
         53      > RETURN                                                   $23
   28    54*     > RETURN                                                   null

End of function link_urls

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.06 ms | 1476 KiB | 20 Q