3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $username = 'stn'; $password = '$ta7$T5d'; $url = 'https://purpleportal.net/api/location/v1/ping'; $token = base64_encode($username . ':' . $password); $curl = curl_init(); $headers = [ "Content-Type: application/json", "Authorization: basic " . $token, ]; curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => true, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $headers ]); $output = curl_exec($curl); // $info = curl_getinfo($curl, CURLINFO_HTTP_CODE); // var_dump($info); var_dump($output);
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/3HtOl
function name:  (null)
number of ops:  36
compiled vars:  !0 = $username, !1 = $password, !2 = $url, !3 = $token, !4 = $curl, !5 = $headers, !6 = $output
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, 'stn'
   4     1        ASSIGN                                                   !1, '%24ta7%24T5d'
   5     2        ASSIGN                                                   !2, 'https%3A%2F%2Fpurpleportal.net%2Fapi%2Flocation%2Fv1%2Fping'
   6     3        INIT_FCALL                                               'base64_encode'
         4        CONCAT                                           ~10     !0, '%3A'
         5        CONCAT                                           ~11     ~10, !1
         6        SEND_VAL                                                 ~11
         7        DO_ICALL                                         $12     
         8        ASSIGN                                                   !3, $12
   7     9        INIT_FCALL_BY_NAME                                       'curl_init'
        10        DO_FCALL                                      0  $14     
        11        ASSIGN                                                   !4, $14
   9    12        INIT_ARRAY                                       ~16     'Content-Type%3A+application%2Fjson'
  10    13        CONCAT                                           ~17     'Authorization%3A+basic+', !3
        14        ADD_ARRAY_ELEMENT                                ~16     ~17
        15        ASSIGN                                                   !5, ~16
  12    16        INIT_FCALL_BY_NAME                                       'curl_setopt_array'
        17        SEND_VAR_EX                                              !4
  13    18        FETCH_CONSTANT                                   ~19     'CURLOPT_RETURNTRANSFER'
        19        INIT_ARRAY                                       ~20     1, ~19
  14    20        FETCH_CONSTANT                                   ~21     'CURLOPT_HEADER'
  13    21        ADD_ARRAY_ELEMENT                                ~20     <true>, ~21
  15    22        FETCH_CONSTANT                                   ~22     'CURLOPT_URL'
        23        ADD_ARRAY_ELEMENT                                ~20     !2, ~22
  16    24        FETCH_CONSTANT                                   ~23     'CURLOPT_HTTPHEADER'
        25        ADD_ARRAY_ELEMENT                                ~20     !5, ~23
        26        SEND_VAL_EX                                              ~20
        27        DO_FCALL                                      0          
  19    28        INIT_FCALL_BY_NAME                                       'curl_exec'
        29        SEND_VAR_EX                                              !4
        30        DO_FCALL                                      0  $25     
        31        ASSIGN                                                   !6, $25
  22    32        INIT_FCALL                                               'var_dump'
        33        SEND_VAR                                                 !6
        34        DO_ICALL                                                 
        35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0