3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Result to be returned as json class Result implements \JsonSerializable { private $error; private $accessToken; public function __construct($anErrorName, $anAccessToken) { $this->error = $anErrorName; $this->accessToken = $anAccessToken; } public function jsonSerialize() { return get_object_vars($this); } } // 1. check if referer is Unity else echo error $referrer = (string)$_SERVER['HTTP_USER_AGENT']; if (strpos($referrer, 'Unity') !== false) { // we're pl } else { $result = new Result("true", 0); echo json_encode($result); exit(); } foreach( $_POST as $key=>$value) { if( is_array( $value ) ) { foreach( $value as $thing ) { echo $thing . "\xA"; } } else { echo "$key=$value" . "\xA"; } } echo'test' . "\xA";; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 41
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 41
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 33
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 33
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 12
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/t77OI
function name:  (null)
number of ops:  44
compiled vars:  !0 = $referrer, !1 = $result, !2 = $value, !3 = $key, !4 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'result'
   20     1        FETCH_R                      global              ~5      '_SERVER'
          2        FETCH_DIM_R                                      ~6      ~5, 'HTTP_USER_AGENT'
          3        CAST                                          6  ~7      ~6
          4        ASSIGN                                                   !0, ~7
   21     5        INIT_FCALL                                               'strpos'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'Unity'
          8        DO_ICALL                                         $9      
          9        TYPE_CHECK                                  1018          $9
         10      > JMPZ                                                     ~10, ->12
         11    > > JMP                                                      ->22
   24    12    >   NEW                                              $11     'Result'
         13        SEND_VAL_EX                                              'true'
         14        SEND_VAL_EX                                              0
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !1, $11
   25    17        INIT_FCALL                                               'json_encode'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $14     
         20        ECHO                                                     $14
   26    21      > EXIT                                                     
   37    22    >   FETCH_R                      global              ~15     '_POST'
         23      > FE_RESET_R                                       $16     ~15, ->41
         24    > > FE_FETCH_R                                       ~17     $16, !2, ->41
         25    >   ASSIGN                                                   !3, ~17
   38    26        TYPE_CHECK                                  128          !2
         27      > JMPZ                                                     ~19, ->35
   39    28    > > FE_RESET_R                                       $20     !2, ->33
         29    > > FE_FETCH_R                                               $20, !4, ->33
   40    30    >   CONCAT                                           ~21     !4, '%0A'
         31        ECHO                                                     ~21
   39    32      > JMP                                                      ->29
         33    >   FE_FREE                                                  $20
         34      > JMP                                                      ->40
   43    35    >   ROPE_INIT                                     3  ~23     !3
         36        ROPE_ADD                                      1  ~23     ~23, '%3D'
         37        ROPE_END                                      2  ~22     ~23, !2
         38        CONCAT                                           ~25     ~22, '%0A'
         39        ECHO                                                     ~25
   37    40    > > JMP                                                      ->24
         41    >   FE_FREE                                                  $16
   47    42        ECHO                                                     'test%0A'
   54    43      > RETURN                                                   1

Class Result:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t77OI
function name:  __construct
number of ops:  7
compiled vars:  !0 = $anErrorName, !1 = $anAccessToken
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSIGN_OBJ                                               'error'
          3        OP_DATA                                                  !0
   11     4        ASSIGN_OBJ                                               'accessToken'
          5        OP_DATA                                                  !1
   12     6      > RETURN                                                   null

End of function __construct

Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t77OI
function name:  jsonSerialize
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'get_object_vars'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   16     5*     > RETURN                                                   null

End of function jsonserialize

End of class Result.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.88 ms | 1400 KiB | 19 Q