3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = '[https://www.quora.com]'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); if ($result === false) { echo 'broken url'; } else { $newUrl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); if ($newUrl !== $url) { echo 'redirect to: ' . $newUrl; } } curl_close($curl);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/M7scW
function name:  (null)
number of ops:  44
compiled vars:  !0 = $url, !1 = $curl, !2 = $result, !3 = $newUrl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bhttps%3A%2F%2Fwww.quora.com%5D'
    4     1        INIT_FCALL_BY_NAME                                       'curl_init'
          2        DO_FCALL                                      0  $5      
          3        ASSIGN                                                   !1, $5
    5     4        INIT_FCALL_BY_NAME                                       'curl_setopt'
          5        SEND_VAR_EX                                              !1
          6        FETCH_CONSTANT                                   ~7      'CURLOPT_URL'
          7        SEND_VAL_EX                                              ~7
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    6    10        INIT_FCALL_BY_NAME                                       'curl_setopt'
         11        SEND_VAR_EX                                              !1
         12        FETCH_CONSTANT                                   ~9      'CURLOPT_FOLLOWLOCATION'
         13        SEND_VAL_EX                                              ~9
         14        SEND_VAL_EX                                              <true>
         15        DO_FCALL                                      0          
    7    16        INIT_FCALL_BY_NAME                                       'curl_setopt'
         17        SEND_VAR_EX                                              !1
         18        FETCH_CONSTANT                                   ~11     'CURLOPT_RETURNTRANSFER'
         19        SEND_VAL_EX                                              ~11
         20        SEND_VAL_EX                                              <true>
         21        DO_FCALL                                      0          
    9    22        INIT_FCALL_BY_NAME                                       'curl_exec'
         23        SEND_VAR_EX                                              !1
         24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !2, $13
   11    26        TYPE_CHECK                                    4          !2
         27      > JMPZ                                                     ~15, ->30
   12    28    >   ECHO                                                     'broken+url'
         29      > JMP                                                      ->40
   14    30    >   INIT_FCALL_BY_NAME                                       'curl_getinfo'
         31        SEND_VAR_EX                                              !1
         32        FETCH_CONSTANT                                   ~16     'CURLINFO_EFFECTIVE_URL'
         33        SEND_VAL_EX                                              ~16
         34        DO_FCALL                                      0  $17     
         35        ASSIGN                                                   !3, $17
   16    36        IS_NOT_IDENTICAL                                         !3, !0
         37      > JMPZ                                                     ~19, ->40
   17    38    >   CONCAT                                           ~20     'redirect+to%3A+', !3
         39        ECHO                                                     ~20
   20    40    >   INIT_FCALL_BY_NAME                                       'curl_close'
         41        SEND_VAR_EX                                              !1
         42        DO_FCALL                                      0          
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.6 ms | 1399 KiB | 13 Q