3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "~(?:f|ht)tps?://[a-z\d.-]+\.[a-z]{2,3}\S*~i"; $text = 'http://google.com and http://facebook.com?12345678901234567890123456789012345678901234567890 are big companies. A good example for shopping site is http://amazon.com'; echo preg_replace_callback($pattern, function($m) { return "<a href=\"{$m[0]}\" rel=\"nofollow\"><b>" . (strlen($m[0]) > 50 ? substr($m[0], 0, 50) . "..." : $m[0]) . "</b></a>"; }, $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bXE9u
function name:  (null)
number of ops:  10
compiled vars:  !0 = $pattern, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7E%28%3F%3Af%7Cht%29tps%3F%3A%2F%2F%5Ba-z%5Cd.-%5D%2B%5C.%5Ba-z%5D%7B2%2C3%7D%5CS%2A%7Ei'
    4     1        ASSIGN                                                   !1, 'http%3A%2F%2Fgoogle.com%0Aand+http%3A%2F%2Ffacebook.com%3F12345678901234567890123456789012345678901234567890+are+big+companies.%0AA+good+example+for+shopping+site+is+http%3A%2F%2Famazon.com'
    8     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   10     5        SEND_VAL                                                 ~4
          6        SEND_VAR                                                 !1
    8     7        DO_ICALL                                         $5      
   10     8        ECHO                                                     $5
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bXE9u
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ROPE_INIT                                     3  ~3      '%3Ca+href%3D%22'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        ROPE_ADD                                      1  ~3      ~3, ~1
          4        ROPE_END                                      2  ~2      ~3, '%22+rel%3D%22nofollow%22%3E%3Cb%3E'
          5        FETCH_DIM_R                                      ~5      !0, 0
          6        STRLEN                                           ~6      ~5
          7        IS_SMALLER                                               50, ~6
          8      > JMPZ                                                     ~7, ->18
          9    >   INIT_FCALL                                               'substr'
         10        FETCH_DIM_R                                      ~8      !0, 0
         11        SEND_VAL                                                 ~8
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 50
         14        DO_ICALL                                         $9      
         15        CONCAT                                           ~10     $9, '...'
         16        QM_ASSIGN                                        ~11     ~10
         17      > JMP                                                      ->20
         18    >   FETCH_DIM_R                                      ~12     !0, 0
         19        QM_ASSIGN                                        ~11     ~12
         20    >   CONCAT                                           ~13     ~2, ~11
         21        CONCAT                                           ~14     ~13, '%3C%2Fb%3E%3C%2Fa%3E'
         22      > RETURN                                                   ~14
   10    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.14 ms | 1016 KiB | 15 Q