3v4l.org

run code in 500+ 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 = 45
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 45
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
Branch analysis from position: 34
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/39kOS
function name:  link_urls
number of ops:  49
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, ->45
          8    > > FE_FETCH_RW                                                  $10, !3, ->45
   11     9    >   FRAMELESS_ICALL_2                strpos              ~11     !3, '%3A%2F%2F'
         10        TYPE_CHECK                                        4          ~11
         11      > JMPZ                                                         ~12, ->13
   12    12    > > JMP                                                          ->8
   15    13    >   INIT_FCALL                                                   'mb_substr'
         14        SEND_VAR                                                     !3
         15        SEND_VAL                                                     -1
         16        DO_ICALL                                             $13     
         17        ASSIGN                                                       !4, $13
   17    18        INIT_FCALL                                                   'preg_match'
         19        SEND_VAL                                                     '%2F%5B%5Ea-zA-Z0-9%5C%2F%5D%2F'
         20        SEND_VAR                                                     !4
         21        SEND_REF                                                     !5
         22        DO_ICALL                                                     
   18    23      > JMPZ                                                         !5, ->26
         24    >   QM_ASSIGN                                            ~16     !4
         25      > JMP                                                          ->27
         26    >   QM_ASSIGN                                            ~16     ''
         27    >   ASSIGN                                                       !6, ~16
   20    28        INIT_FCALL                                                   'sprintf'
   21    29        SEND_VAL                                                     '%3Ca+href%3D%22%251%24s%22%3E%251%24s%3C%2Fa%3E%252%24s'
   22    30        IS_IDENTICAL                                                 !6, ''
         31      > JMPZ                                                         ~18, ->34
         32    >   QM_ASSIGN                                            ~19     !3
         33      > JMP                                                          ->40
         34    >   INIT_FCALL                                                   'mb_substr'
         35        SEND_VAR                                                     !3
         36        SEND_VAL                                                     0
         37        SEND_VAL                                                     -1
         38        DO_ICALL                                             $20     
         39        QM_ASSIGN                                            ~19     $20
         40    >   SEND_VAL                                                     ~19
   23    41        SEND_VAR                                                     !6
   20    42        DO_ICALL                                             $21     
         43        ASSIGN                                                       !3, $21
   10    44      > JMP                                                          ->8
         45    >   FE_FREE                                                      $10
   27    46        FRAMELESS_ICALL_2                implode             ~23     '+', !2
         47      > RETURN                                                       ~23
   28    48*     > RETURN                                                       null

End of function link_urls

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.84 ms | 2586 KiB | 18 Q