3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ["http://www.example.com//wp-content/uploads/2017/07/Sidetracks-Main-1.jpg", "/wp-content/uploads/2017/01/45432.jpg", "/wp-content/uploads/2016/07/39223.jpg"]; foreach($arr as &$link){ $link = str_replace("http://", "https://", $link); if(substr($link,0,8) != "https://") $link = "https://www.example.com" . $link; } Var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 19
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/G0AiQ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $link
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_RW                                      $3      !0, ->19
          2    > > FE_FETCH_RW                                              $3, !1, ->19
    6     3    >   INIT_FCALL                                               'str_replace'
          4        SEND_VAL                                                 'http%3A%2F%2F'
          5        SEND_VAL                                                 'https%3A%2F%2F'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
    7     9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 8
         13        DO_ICALL                                         $6      
         14        IS_NOT_EQUAL                                             $6, 'https%3A%2F%2F'
         15      > JMPZ                                                     ~7, ->18
         16    >   CONCAT                                           ~8      'https%3A%2F%2Fwww.example.com', !1
         17        ASSIGN                                                   !1, ~8
    5    18    > > JMP                                                      ->2
         19    >   FE_FREE                                                  $3
   10    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
283.91 ms | 1012 KiB | 16 Q