3v4l.org

run code in 300+ PHP versions simultaneously
<?php function http_head_curl($url,$timeout=30) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $res = curl_exec($ch); if ($res === false) { throw new RuntimeException("cURL exception: ".curl_errno($ch).": ".curl_error($ch)); } return trim($res); } // Fails: echo(http_head_curl('www.google.com')); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VH6Uc
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'http_head_curl'
          1        SEND_VAL                                                 'www.google.com'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   21     4      > RETURN                                                   1

Function http_head_curl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 60
Branch analysis from position: 47
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VH6Uc
function name:  http_head_curl
number of ops:  65
compiled vars:  !0 = $url, !1 = $timeout, !2 = $ch, !3 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      30
    4     2        INIT_FCALL_BY_NAME                                       'curl_init'
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !2, $4
    5     5        INIT_FCALL_BY_NAME                                       'curl_setopt'
          6        SEND_VAR_EX                                              !2
          7        FETCH_CONSTANT                                   ~6      'CURLOPT_URL'
          8        SEND_VAL_EX                                              ~6
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
    6    11        INIT_FCALL_BY_NAME                                       'curl_setopt'
         12        SEND_VAR_EX                                              !2
         13        FETCH_CONSTANT                                   ~8      'CURLOPT_TIMEOUT'
         14        SEND_VAL_EX                                              ~8
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
    7    17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !2
         19        FETCH_CONSTANT                                   ~10     'CURLOPT_HEADER'
         20        SEND_VAL_EX                                              ~10
         21        SEND_VAL_EX                                              1
         22        DO_FCALL                                      0          
    8    23        INIT_FCALL_BY_NAME                                       'curl_setopt'
         24        SEND_VAR_EX                                              !2
         25        FETCH_CONSTANT                                   ~12     'CURLOPT_NOBODY'
         26        SEND_VAL_EX                                              ~12
         27        SEND_VAL_EX                                              1
         28        DO_FCALL                                      0          
    9    29        INIT_FCALL_BY_NAME                                       'curl_setopt'
         30        SEND_VAR_EX                                              !2
         31        FETCH_CONSTANT                                   ~14     'CURLOPT_FOLLOWLOCATION'
         32        SEND_VAL_EX                                              ~14
         33        SEND_VAL_EX                                              1
         34        DO_FCALL                                      0          
   10    35        INIT_FCALL_BY_NAME                                       'curl_setopt'
         36        SEND_VAR_EX                                              !2
         37        FETCH_CONSTANT                                   ~16     'CURLOPT_RETURNTRANSFER'
         38        SEND_VAL_EX                                              ~16
         39        SEND_VAL_EX                                              1
         40        DO_FCALL                                      0          
   11    41        INIT_FCALL_BY_NAME                                       'curl_exec'
         42        SEND_VAR_EX                                              !2
         43        DO_FCALL                                      0  $18     
         44        ASSIGN                                                   !3, $18
   12    45        TYPE_CHECK                                    4          !3
         46      > JMPZ                                                     ~20, ->60
   13    47    >   NEW                                              $21     'RuntimeException'
         48        INIT_FCALL_BY_NAME                                       'curl_errno'
         49        SEND_VAR_EX                                              !2
         50        DO_FCALL                                      0  $22     
         51        CONCAT                                           ~23     'cURL+exception%3A+', $22
         52        CONCAT                                           ~24     ~23, '%3A+'
         53        INIT_FCALL_BY_NAME                                       'curl_error'
         54        SEND_VAR_EX                                              !2
         55        DO_FCALL                                      0  $25     
         56        CONCAT                                           ~26     ~24, $25
         57        SEND_VAL_EX                                              ~26
         58        DO_FCALL                                      0          
         59      > THROW                                         0          $21
   15    60    >   INIT_FCALL                                               'trim'
         61        SEND_VAR                                                 !3
         62        DO_ICALL                                         $28     
         63      > RETURN                                                   $28
   16    64*     > RETURN                                                   null

End of function http_head_curl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.21 ms | 1403 KiB | 16 Q