3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once (dirname(__FILE__) . "/sha256.php"); $AWS_ACCESS_KEY = 'AKIAIDMODWRW3CRDO2BA'; $AWS_PRIVATE_KEY = 'kMuJRvcejqzMvmoZWsURIDKkteVTXa3ReDXQ6RqE'; $AWS_REGION = 'us-west-2'; $TOPIC_ARN_UPDATECUS = 'arn:aws:sns:us-west-2:791920038536:updateCusNumberRequest'; $endpoints = array( 'US-EAST-1' => 'sns.us-east-1.amazonaws.com', 'US-WEST-1' => 'sns.us-west-1.amazonaws.com', 'US-WEST-2' => 'sns.us-west-2.amazonaws.com', 'EU-WEST-1' => 'sns.eu-west-1.amazonaws.com', 'AP-SE-1' => 'sns.ap-southeast-1.amazonaws.com', 'AP-NE-1' => 'sns.ap-northeast-1.amazonaws.com', 'SA-EAST-1' => 'sns.sa-east-1.amazonaws.com' ); $endpoint = $endpoints[strtoupper($AWS_REGION)]; $protocol = 'https://'; $email = ''; $cus_id = ''; if ($argc >= 2) { $email = $argv[1]; $cus_id = $argv[2]; } $message = array( 'topic' => 'updateCusNumberRequest', 'email' => $email, 'cus_id' => $cus_id ); $params = array( 'TopicArn' => $TOPIC_ARN_UPDATECUS, 'Message' => php_compat_json_encode($message) ); $params['Action'] = 'Publish'; $params['AWSAccessKeyId'] = $AWS_ACCESS_KEY; $params['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z'); $params['SignatureVersion'] = 2; $params['SignatureMethod'] = 'HmacSHA256'; uksort($params, 'strnatcmp'); $queryString = ''; foreach ($params as $key => $val) { $queryString .= "&{$key}=".rawurlencode($val); } $queryString = substr($queryString, 1); $requestString = "GET\n" . $endpoint."\n" . "/\n" . $queryString; $params['Signature'] = base64_encode( php_compat_hash_hmac('sha256', $requestString, $AWS_PRIVATE_KEY, true) ); $request = $protocol . $endpoint . '/?' . php_compat_http_build_query($params); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); $curlErrorNo = curl_errno($ch); $curlError = curl_error($ch); $info = curl_getinfo($ch); curl_close($ch); if ((floor($info['http_code'] / 100) == 2) === false) { if (strpos($output, '<Error>') !== FALSE) { echo "Amazon returned an XML error " . $output; } else{ if(!empty($curlErrorNo)) { echo "There was a problem executing curl" . $curlError . " - " . $curlErrorNo; } else{ echo "There was a problem executing this request " . $info['http_code']; } } } else { echo "All good!"; } /* php4 compatible functions */ //http://bit.ly/1qd0Usl function php_compat_hash_hmac($algo, $data, $key, $raw_output = false) { // Block size (byte) for MD5, SHA-1 and SHA-256. $blocksize = 64; $ipad = str_repeat("\x36", $blocksize); $opad = str_repeat("\x5c", $blocksize); if (strlen($key) > $blocksize) { $key = php_compat_hash($algo, $key, true); } else { $key = str_pad($key, $blocksize, "\x00"); } $ipad ^= $key; $opad ^= $key; return php_compat_hash($algo, $opad . php_compat_hash($algo, $ipad . $data, true), $raw_output); } //http://bit.ly/1nIYD2h function php_compat_hash($algo, $data, $raw_output = false) { $hash = hash('sha256', $data); if ($raw_output) { return pack('H*', $hash); } else { echo "returnhash"; return $hash; } } //http://bit.ly/1uH6OR0 function php_compat_json_encode($a=false) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { if (is_float($a)) { // Always use "." for floats. return floatval(str_replace(",", ".", strval($a))); } if (is_string($a)) { $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"'; } else return $a; } $isList = true; for ($i = 0, reset($a); $i < count($a); $i++, next($a)) { if (key($a) !== $i) { $isList = false; break; } } $result = array(); if ($isList) { foreach ($a as $v) $result[] = php_compat_json_encode($v); return '[' . join(',', $result) . ']'; } else { foreach ($a as $k => $v) $result[] = php_compat_json_encode($k).':'.php_compat_json_encode($v); return '{' . join(',', $result) . '}'; } } //http://bit.ly/1q8GwII function php_compat_http_build_query($data, $prefix = null, $sep = '', $key = '') { $ret = array(); foreach ((array )$data as $k => $v) { $k = urlencode($k); if (is_int($k) && $prefix != null) { $k = $prefix . $k; } if (!empty($key)) { $k = $key . "[" . $k . "]"; } if (is_array($v) || is_object($v)) { array_push($ret, http_build_query($v, "", $sep, $k)); } else { array_push($ret, $k . "=" . urlencode($v)); } } if (empty($sep)) { $sep = ini_get("arg_separator.output"); } return implode($sep, $ret); } if (!function_exists('hash')) { function hash($algo, $data) { if (empty($algo) || !is_string($algo) || !is_string($data)) { return false; } if (function_exists($algo)) { return $algo($data); } } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 53, Position 2 = 64
Branch analysis from position: 53
2 jumps found. (Code = 78) Position 1 = 54, Position 2 = 64
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 135, Position 2 = 156
Branch analysis from position: 135
2 jumps found. (Code = 43) Position 1 = 141, Position 2 = 144
Branch analysis from position: 141
1 jumps found. (Code = 42) Position 1 = 155
Branch analysis from position: 155
1 jumps found. (Code = 42) Position 1 = 157
Branch analysis from position: 157
2 jumps found. (Code = 43) Position 1 = 162, Position 2 = 163
Branch analysis from position: 162
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 163
Branch analysis from position: 144
2 jumps found. (Code = 43) Position 1 = 147, Position 2 = 152
Branch analysis from position: 147
1 jumps found. (Code = 42) Position 1 = 155
Branch analysis from position: 155
Branch analysis from position: 152
1 jumps found. (Code = 42) Position 1 = 157
Branch analysis from position: 157
Branch analysis from position: 156
2 jumps found. (Code = 43) Position 1 = 162, Position 2 = 163
Branch analysis from position: 162
Branch analysis from position: 163
Branch analysis from position: 64
Branch analysis from position: 24
filename:       /in/MaWaH
function name:  (null)
number of ops:  164
compiled vars:  !0 = $AWS_ACCESS_KEY, !1 = $AWS_PRIVATE_KEY, !2 = $AWS_REGION, !3 = $TOPIC_ARN_UPDATECUS, !4 = $endpoints, !5 = $endpoint, !6 = $protocol, !7 = $email, !8 = $cus_id, !9 = $argc, !10 = $argv, !11 = $message, !12 = $params, !13 = $queryString, !14 = $val, !15 = $key, !16 = $requestString, !17 = $request, !18 = $ch, !19 = $output, !20 = $curlErrorNo, !21 = $curlError, !22 = $info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'dirname'
          1        SEND_VAL                                                 '%2Fin%2FMaWaH'
          2        DO_ICALL                                         $23     
          3        CONCAT                                           ~24     $23, '%2Fsha256.php'
          4        INCLUDE_OR_EVAL                                          ~24, REQUIRE_ONCE
    5     5        ASSIGN                                                   !0, 'AKIAIDMODWRW3CRDO2BA'
    6     6        ASSIGN                                                   !1, 'kMuJRvcejqzMvmoZWsURIDKkteVTXa3ReDXQ6RqE'
    7     7        ASSIGN                                                   !2, 'us-west-2'
    8     8        ASSIGN                                                   !3, 'arn%3Aaws%3Asns%3Aus-west-2%3A791920038536%3AupdateCusNumberRequest'
   10     9        ASSIGN                                                   !4, <array>
   20    10        INIT_FCALL                                               'strtoupper'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $31     
         13        FETCH_DIM_R                                      ~32     !4, $31
         14        ASSIGN                                                   !5, ~32
   21    15        ASSIGN                                                   !6, 'https%3A%2F%2F'
   22    16        ASSIGN                                                   !7, ''
   23    17        ASSIGN                                                   !8, ''
   25    18        IS_SMALLER_OR_EQUAL                                      2, !9
         19      > JMPZ                                                     ~37, ->24
   27    20    >   FETCH_DIM_R                                      ~38     !10, 1
         21        ASSIGN                                                   !7, ~38
   28    22        FETCH_DIM_R                                      ~40     !10, 2
         23        ASSIGN                                                   !8, ~40
   32    24    >   INIT_ARRAY                                       ~42     'updateCusNumberRequest', 'topic'
   33    25        ADD_ARRAY_ELEMENT                                ~42     !7, 'email'
   34    26        ADD_ARRAY_ELEMENT                                ~42     !8, 'cus_id'
   31    27        ASSIGN                                                   !11, ~42
   38    28        INIT_ARRAY                                       ~44     !3, 'TopicArn'
   39    29        INIT_FCALL_BY_NAME                                       'php_compat_json_encode'
         30        SEND_VAR_EX                                              !11
         31        DO_FCALL                                      0  $45     
         32        ADD_ARRAY_ELEMENT                                ~44     $45, 'Message'
   37    33        ASSIGN                                                   !12, ~44
   42    34        ASSIGN_DIM                                               !12, 'Action'
         35        OP_DATA                                                  'Publish'
   43    36        ASSIGN_DIM                                               !12, 'AWSAccessKeyId'
         37        OP_DATA                                                  !0
   44    38        INIT_FCALL                                               'gmdate'
         39        SEND_VAL                                                 'Y-m-d%5CTH%3Ai%3As%5CZ'
         40        DO_ICALL                                         $50     
         41        ASSIGN_DIM                                               !12, 'Timestamp'
         42        OP_DATA                                                  $50
   45    43        ASSIGN_DIM                                               !12, 'SignatureVersion'
         44        OP_DATA                                                  2
   46    45        ASSIGN_DIM                                               !12, 'SignatureMethod'
         46        OP_DATA                                                  'HmacSHA256'
   48    47        INIT_FCALL                                               'uksort'
         48        SEND_REF                                                 !12
         49        SEND_VAL                                                 'strnatcmp'
         50        DO_ICALL                                                 
   49    51        ASSIGN                                                   !13, ''
   50    52      > FE_RESET_R                                       $55     !12, ->64
         53    > > FE_FETCH_R                                       ~56     $55, !14, ->64
         54    >   ASSIGN                                                   !15, ~56
   51    55        ROPE_INIT                                     3  ~59     '%26'
         56        ROPE_ADD                                      1  ~59     ~59, !15
         57        ROPE_END                                      2  ~58     ~59, '%3D'
         58        INIT_FCALL                                               'rawurlencode'
         59        SEND_VAR                                                 !14
         60        DO_ICALL                                         $61     
         61        CONCAT                                           ~62     ~58, $61
         62        ASSIGN_OP                                     8          !13, ~62
   50    63      > JMP                                                      ->53
         64    >   FE_FREE                                                  $55
   53    65        INIT_FCALL                                               'substr'
         66        SEND_VAR                                                 !13
         67        SEND_VAL                                                 1
         68        DO_ICALL                                         $64     
         69        ASSIGN                                                   !13, $64
   56    70        CONCAT                                           ~66     'GET%0A', !5
         71        CONCAT                                           ~67     ~66, '%0A'
   57    72        CONCAT                                           ~68     ~67, '%2F%0A'
   58    73        CONCAT                                           ~69     ~68, !13
   55    74        ASSIGN                                                   !16, ~69
   60    75        INIT_FCALL                                               'base64_encode'
   61    76        INIT_FCALL_BY_NAME                                       'php_compat_hash_hmac'
         77        SEND_VAL_EX                                              'sha256'
         78        SEND_VAR_EX                                              !16
         79        SEND_VAR_EX                                              !1
         80        SEND_VAL_EX                                              <true>
         81        DO_FCALL                                      0  $72     
         82        SEND_VAR                                                 $72
         83        DO_ICALL                                         $73     
   60    84        ASSIGN_DIM                                               !12, 'Signature'
   61    85        OP_DATA                                                  $73
   64    86        CONCAT                                           ~74     !6, !5
         87        CONCAT                                           ~75     ~74, '%2F%3F'
         88        INIT_FCALL_BY_NAME                                       'php_compat_http_build_query'
         89        SEND_VAR_EX                                              !12
         90        DO_FCALL                                      0  $76     
         91        CONCAT                                           ~77     ~75, $76
         92        ASSIGN                                                   !17, ~77
   66    93        INIT_FCALL_BY_NAME                                       'curl_init'
         94        DO_FCALL                                      0  $79     
         95        ASSIGN                                                   !18, $79
   67    96        INIT_FCALL_BY_NAME                                       'curl_setopt'
         97        SEND_VAR_EX                                              !18
         98        FETCH_CONSTANT                                   ~81     'CURLOPT_URL'
         99        SEND_VAL_EX                                              ~81
        100        SEND_VAR_EX                                              !17
        101        DO_FCALL                                      0          
   68   102        INIT_FCALL_BY_NAME                                       'curl_setopt'
        103        SEND_VAR_EX                                              !18
        104        FETCH_CONSTANT                                   ~83     'CURLOPT_RETURNTRANSFER'
        105        SEND_VAL_EX                                              ~83
        106        SEND_VAL_EX                                              <true>
        107        DO_FCALL                                      0          
   70   108        INIT_FCALL_BY_NAME                                       'curl_exec'
        109        SEND_VAR_EX                                              !18
        110        DO_FCALL                                      0  $85     
        111        ASSIGN                                                   !19, $85
   72   112        INIT_FCALL_BY_NAME                                       'curl_errno'
        113        SEND_VAR_EX                                              !18
        114        DO_FCALL                                      0  $87     
        115        ASSIGN                                                   !20, $87
   73   116        INIT_FCALL_BY_NAME                                       'curl_error'
        117        SEND_VAR_EX                                              !18
        118        DO_FCALL                                      0  $89     
        119        ASSIGN                                                   !21, $89
   74   120        INIT_FCALL_BY_NAME                                       'curl_getinfo'
        121        SEND_VAR_EX                                              !18
        122        DO_FCALL                                      0  $91     
        123        ASSIGN                                                   !22, $91
   76   124        INIT_FCALL_BY_NAME                                       'curl_close'
        125        SEND_VAR_EX                                              !18
        126        DO_FCALL                                      0          
   78   127        INIT_FCALL                                               'floor'
        128        FETCH_DIM_R                                      ~94     !22, 'http_code'
        129        DIV                                              ~95     ~94, 100
        130        SEND_VAL                                                 ~95
        131        DO_ICALL                                         $96     
        132        IS_EQUAL                                         ~97     $96, 2
        133        TYPE_CHECK                                    4          ~97
        134      > JMPZ                                                     ~98, ->156
   80   135    >   INIT_FCALL                                               'strpos'
        136        SEND_VAR                                                 !19
        137        SEND_VAL                                                 '%3CError%3E'
        138        DO_ICALL                                         $99     
        139        TYPE_CHECK                                  1018          $99
        140      > JMPZ                                                     ~100, ->144
   82   141    >   CONCAT                                           ~101    'Amazon+returned+an+XML+error+', !19
        142        ECHO                                                     ~101
        143      > JMP                                                      ->155
   85   144    >   ISSET_ISEMPTY_CV                                 ~102    !20
        145        BOOL_NOT                                         ~103    ~102
        146      > JMPZ                                                     ~103, ->152
   87   147    >   CONCAT                                           ~104    'There+was+a+problem+executing+curl', !21
        148        CONCAT                                           ~105    ~104, '+-+'
        149        CONCAT                                           ~106    ~105, !20
        150        ECHO                                                     ~106
        151      > JMP                                                      ->155
   90   152    >   FETCH_DIM_R                                      ~107    !22, 'http_code'
        153        CONCAT                                           ~108    'There+was+a+problem+executing+this+request+', ~107
        154        ECHO                                                     ~108
        155    > > JMP                                                      ->157
   96   156    >   ECHO                                                     'All+good%21'
  208   157    >   INIT_FCALL                                               'function_exists'
        158        SEND_VAL                                                 'hash'
        159        DO_ICALL                                         $109    
        160        BOOL_NOT                                         ~110    $109
        161      > JMPZ                                                     ~110, ->163
  210   162    >   DECLARE_FUNCTION                                         'hash'
  222   163    > > RETURN                                                   1

Function php_compat_hash_hmac:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MaWaH
function name:  php_compat_hash_hmac
number of ops:  47
compiled vars:  !0 = $algo, !1 = $data, !2 = $key, !3 = $raw_output, !4 = $blocksize, !5 = $ipad, !6 = $opad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  103     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      <false>
  106     4        ASSIGN                                                   !4, 64
  108     5        INIT_FCALL                                               'str_repeat'
          6        SEND_VAL                                                 '6'
          7        SEND_VAR                                                 !4
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !5, $8
  109    10        INIT_FCALL                                               'str_repeat'
         11        SEND_VAL                                                 '%5C'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !6, $10
  111    15        STRLEN                                           ~12     !2
         16        IS_SMALLER                                               !4, ~12
         17      > JMPZ                                                     ~13, ->25
  112    18    >   INIT_FCALL_BY_NAME                                       'php_compat_hash'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAR_EX                                              !2
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0  $14     
         23        ASSIGN                                                   !2, $14
         24      > JMP                                                      ->31
  114    25    >   INIT_FCALL                                               'str_pad'
         26        SEND_VAR                                                 !2
         27        SEND_VAR                                                 !4
         28        SEND_VAL                                                 '%00'
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !2, $16
  117    31    >   ASSIGN_OP                                    11          !5, !2
  118    32        ASSIGN_OP                                    11          !6, !2
  120    33        INIT_FCALL_BY_NAME                                       'php_compat_hash'
         34        SEND_VAR_EX                                              !0
         35        INIT_FCALL_BY_NAME                                       'php_compat_hash'
         36        SEND_VAR_EX                                              !0
         37        CONCAT                                           ~20     !5, !1
         38        SEND_VAL_EX                                              ~20
         39        SEND_VAL_EX                                              <true>
         40        DO_FCALL                                      0  $21     
         41        CONCAT                                           ~22     !6, $21
         42        SEND_VAL_EX                                              ~22
         43        SEND_VAR_EX                                              !3
         44        DO_FCALL                                      0  $23     
         45      > RETURN                                                   $23
  121    46*     > RETURN                                                   null

End of function php_compat_hash_hmac

Function php_compat_hash:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MaWaH
function name:  php_compat_hash
number of ops:  18
compiled vars:  !0 = $algo, !1 = $data, !2 = $raw_output, !3 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  124     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
  126     3        INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'sha256'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !3, $4
  128     8      > JMPZ                                                     !2, ->15
  129     9    >   INIT_FCALL                                               'pack'
         10        SEND_VAL                                                 'H%2A'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $6      
         13      > RETURN                                                   $6
         14*       JMP                                                      ->17
  131    15    >   ECHO                                                     'returnhash'
  132    16      > RETURN                                                   !3
  134    17*     > RETURN                                                   null

End of function php_compat_hash

Function php_compat_json_encode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 37
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 36
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 43
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 76
Branch analysis from position: 59
2 jumps found. (Code = 77) Position 1 = 60, Position 2 = 67
Branch analysis from position: 60
2 jumps found. (Code = 78) Position 1 = 61, Position 2 = 67
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
Branch analysis from position: 76
2 jumps found. (Code = 77) Position 1 = 77, Position 2 = 90
Branch analysis from position: 77
2 jumps found. (Code = 78) Position 1 = 78, Position 2 = 90
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 90
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 43
Branch analysis from position: 57
Branch analysis from position: 43
filename:       /in/MaWaH
function name:  php_compat_json_encode
number of ops:  99
compiled vars:  !0 = $a, !1 = $jsonReplaces, !2 = $isList, !3 = $i, !4 = $result, !5 = $v, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  137     0  E >   RECV_INIT                                        !0      <false>
  139     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~7, ->4
          3    > > RETURN                                                   'null'
  140     4    >   TYPE_CHECK                                    4          !0
          5      > JMPZ                                                     ~8, ->7
          6    > > RETURN                                                   'false'
  141     7    >   TYPE_CHECK                                    8          !0
          8      > JMPZ                                                     ~9, ->10
          9    > > RETURN                                                   'true'
  142    10    >   TYPE_CHECK                                  124          !0
         11      > JMPZ                                                     ~10, ->37
  144    12    >   TYPE_CHECK                                   32          !0
         13      > JMPZ                                                     ~11, ->22
  147    14    >   INIT_FCALL                                               'str_replace'
         15        SEND_VAL                                                 '%2C'
         16        SEND_VAL                                                 '.'
         17        CAST                                          6  ~12     !0
         18        SEND_VAL                                                 ~12
         19        DO_ICALL                                         $13     
         20        CAST                                          5  ~14     $13
         21      > RETURN                                                   ~14
  150    22    >   TYPE_CHECK                                   64          !0
         23      > JMPZ                                                     ~15, ->36
  152    24    >   ASSIGN                                                   !1, <array>
  153    25        INIT_FCALL                                               'str_replace'
         26        FETCH_DIM_R                                      ~17     !1, 0
         27        SEND_VAL                                                 ~17
         28        FETCH_DIM_R                                      ~18     !1, 1
         29        SEND_VAL                                                 ~18
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $19     
         32        CONCAT                                           ~20     '%22', $19
         33        CONCAT                                           ~21     ~20, '%22'
         34      > RETURN                                                   ~21
         35*       JMP                                                      ->37
  156    36    > > RETURN                                                   !0
  158    37    >   ASSIGN                                                   !2, <true>
  159    38        ASSIGN                                                   !3, 0
         39        INIT_FCALL                                               'reset'
         40        SEND_REF                                                 !0
         41        DO_ICALL                                                 
         42      > JMP                                                      ->54
  161    43    >   INIT_FCALL                                               'key'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                         $25     
         46        IS_NOT_IDENTICAL                                         !3, $25
         47      > JMPZ                                                     ~26, ->50
  163    48    >   ASSIGN                                                   !2, <false>
  164    49      > JMP                                                      ->57
  159    50    >   PRE_INC                                                  !3
         51        INIT_FCALL                                               'next'
         52        SEND_REF                                                 !0
         53        DO_ICALL                                                 
         54    >   COUNT                                            ~30     !0
         55        IS_SMALLER                                               !3, ~30
         56      > JMPNZ                                                    ~31, ->43
  167    57    >   ASSIGN                                                   !4, <array>
  168    58      > JMPZ                                                     !2, ->76
  170    59    > > FE_RESET_R                                       $33     !0, ->67
         60    > > FE_FETCH_R                                               $33, !5, ->67
         61    >   INIT_FCALL_BY_NAME                                       'php_compat_json_encode'
         62        SEND_VAR_EX                                              !5
         63        DO_FCALL                                      0  $35     
         64        ASSIGN_DIM                                               !4
         65        OP_DATA                                                  $35
         66      > JMP                                                      ->60
         67    >   FE_FREE                                                  $33
  171    68        INIT_FCALL                                               'join'
         69        SEND_VAL                                                 '%2C'
         70        SEND_VAR                                                 !4
         71        DO_ICALL                                         $36     
         72        CONCAT                                           ~37     '%5B', $36
         73        CONCAT                                           ~38     ~37, '%5D'
         74      > RETURN                                                   ~38
         75*       JMP                                                      ->98
  175    76    > > FE_RESET_R                                       $39     !0, ->90
         77    > > FE_FETCH_R                                       ~40     $39, !5, ->90
         78    >   ASSIGN                                                   !6, ~40
         79        INIT_FCALL_BY_NAME                                       'php_compat_json_encode'
         80        SEND_VAR_EX                                              !6
         81        DO_FCALL                                      0  $43     
         82        CONCAT                                           ~44     $43, '%3A'
        

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.53 ms | 1432 KiB | 51 Q