3v4l.org

run code in 300+ PHP versions simultaneously
<?php // class MyException extends Exception // { // public static $myErrLvls = array( // 1 => "E_ERROR", // 2 => "E_WARNING", // 4 => "E_PARSE", // 8 => "E_NOTICE", // 16 => "E_CORE_ERROR", // 32 => "E_CORE_WARNING", // 64 => "E_COMPILE_ERROR", // 128 => "E_COMPILE_WARNING", // 256 => "E_USER_ERROR", // 512 => "E_USER_WARNING", // 1024 => "E_USER_NOTICE", // 2048 => "E_STRICT", // 4096 => "E_RECOVERABLE_ERROR", // 8192 => "E_DEPRECATED", // 16384 => "E_USER_DEPRECATED", // 32767 => "E_ALL", // ); // private $myMsg; // private $myCode; // public function __construct($message, $code = 0, Exception $previous = null) { // $this->myMsg = $message; // $this->myCode = $code; // parent::__construct($message, $code, $previous); // } // public function __toString() { // return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; // } // public function getErrorArray() { // return array( // 'errLvl' => self::$myErrLvls[$this->myCode], // 'errNo' => $this->myCode, // 'errMsg' => $this->myMsg, // ); // } // } class Odometer { public function __construct(array $values, $max_places = 0){ $this->values = array_values($values); $this->max_places = $max_places; reset($values); $this->register[0] = key($values); end($values); $this->limit = key($values); } public function iterate($force = false){ $rollback = $this->register; $this->register[0]++; var_dump($regsiter); for($i = 0; $i < count($this->register); $i++){ if($this->register[$i] > $this->limit){ $this->register[$i] = 0; if(isset($this->register[$i+1])){ $this->register[$i+1]++; } else { if($this->max_places && count($this->register)+1 > $this->max_places && !$force){ $this->register = $rollback; return; } $this->register[$i+1] = 0; } } } } public function readMeter(){ for($i = 0; $i < count($this->register); $i++){ $meter[$i] = $this->values[$this->register[$i]]; } return $meter; } public function printMeter(){ // $this->setMeter(); return '[' . implode('][', array_reverse($this->readMeter())) . ']' . "\n"; } } $output = array(); $func = 'sqlite_open'; $empty = array( // -1 for no argument "''" => '', "\"\"" => "", "\"\"" => "\n", "' '" => ' ', "0" => 0, "0.0" => 0.0, "NULL" => NULL, "\\0" => "\0", "array()" => array(), "false" => false, "new stdClass()" => new stdClass(), ); // $refl = new ReflectionFunction($func); // $totalNumOfArgs = $refl->getNumberOfParameters(); $o = new Odometer($empty, 2); for($i = 0; $i < 50; $i++){ $o->iterate(); // var_dump($o->readMeter()); } // for($i = -1; $i < count($empty); $i++){ // // $args = isset($empty[$i]) ? array($empty[$i]) : array(); // if(isset($empty[$i])){ // if($i == 0){ $args = array($o->readMeter()); } // else if($i > 0){ $o->iterate(); $args = array($o->readMeter()); } // else { $args = array(); } // } // // try { // // $result = call_user_func_array('sqlite_open', $args); // // $output[$func][$i] = array( // // 'args' => $args, // // 'result' => $result, // // 'result_type' => gettype($result), // // ); // // } catch (MyException $e){ // // $output[$func][$i]['error'] = array( // // $e->getErrorArray(), // // ); // // } // var_dump($args); // }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 23
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 23
Branch analysis from position: 28
Branch analysis from position: 23
filename:       /in/VjrZZ
function name:  (null)
number of ops:  29
compiled vars:  !0 = $output, !1 = $func, !2 = $empty, !3 = $o, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E >   ASSIGN                                                   !0, <array>
   94     1        ASSIGN                                                   !1, 'sqlite_open'
   97     2        INIT_ARRAY                                       ~7      '', '%27%27'
   98     3        ADD_ARRAY_ELEMENT                                ~7      '', '%22%22'
   99     4        ADD_ARRAY_ELEMENT                                ~7      '%0A', '%22%22'
  100     5        ADD_ARRAY_ELEMENT                                ~7      '+', '%27+%27'
  101     6        ADD_ARRAY_ELEMENT                                ~7      0, 0
  102     7        ADD_ARRAY_ELEMENT                                ~7      0, '0.0'
   97     8        ADD_ARRAY_ELEMENT                                ~7      null, 'NULL'
  104     9        ADD_ARRAY_ELEMENT                                ~7      '%00', '%5C0'
   97    10        ADD_ARRAY_ELEMENT                                ~7      <array>, 'array%28%29'
         11        ADD_ARRAY_ELEMENT                                ~7      <false>, 'false'
  107    12        NEW                                              $8      'stdClass'
         13        DO_FCALL                                      0          
         14        ADD_ARRAY_ELEMENT                                ~7      $8, 'new+stdClass%28%29'
   95    15        ASSIGN                                                   !2, ~7
  113    16        NEW                                              $11     'Odometer'
         17        SEND_VAR_EX                                              !2
         18        SEND_VAL_EX                                              2
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !3, $11
  115    21        ASSIGN                                                   !4, 0
         22      > JMP                                                      ->26
  116    23    >   INIT_METHOD_CALL                                         !3, 'iterate'
         24        DO_FCALL                                      0          
  115    25        PRE_INC                                                  !4
         26    >   IS_SMALLER                                               !4, 50
         27      > JMPNZ                                                    ~17, ->23
  142    28    > > RETURN                                                   1

Class Odometer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VjrZZ
function name:  __construct
number of ops:  27
compiled vars:  !0 = $values, !1 = $max_places
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
   50     2        INIT_FCALL                                               'array_values'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN_OBJ                                               'values'
          6        OP_DATA                                                  $3
   51     7        ASSIGN_OBJ                                               'max_places'
          8        OP_DATA                                                  !1
   53     9        INIT_FCALL                                               'reset'
         10        SEND_REF                                                 !0
         11        DO_ICALL                                                 
   54    12        INIT_FCALL                                               'key'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        FETCH_OBJ_W                                      $6      'register'
         16        ASSIGN_DIM                                               $6, 0
         17        OP_DATA                                                  $8
   56    18        INIT_FCALL                                               'end'
         19        SEND_REF                                                 !0
         20        DO_ICALL                                                 
   57    21        INIT_FCALL                                               'key'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $11     
         24        ASSIGN_OBJ                                               'limit'
         25        OP_DATA                                                  $11
   58    26      > RETURN                                                   null

End of function __construct

Function iterate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 11
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 47
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 11
Branch analysis from position: 52
Branch analysis from position: 11
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 11
Branch analysis from position: 52
Branch analysis from position: 11
Branch analysis from position: 39
Branch analysis from position: 36
Branch analysis from position: 47
filename:       /in/VjrZZ
function name:  iterate
number of ops:  53
compiled vars:  !0 = $force, !1 = $rollback, !2 = $regsiter, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV_INIT                                        !0      <false>
   61     1        FETCH_OBJ_R                                      ~4      'register'
          2        ASSIGN                                                   !1, ~4
   62     3        FETCH_OBJ_RW                                     $6      'register'
          4        FETCH_DIM_RW                                     $7      $6, 0
          5        PRE_INC                                                  $7
   63     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                                 
   64     9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->48
   65    11    >   FETCH_OBJ_R                                      ~11     'register'
         12        FETCH_DIM_R                                      ~12     ~11, !3
         13        FETCH_OBJ_R                                      ~13     'limit'
         14        IS_SMALLER                                               ~13, ~12
         15      > JMPZ                                                     ~14, ->47
   66    16    >   FETCH_OBJ_W                                      $15     'register'
         17        ASSIGN_DIM                                               $15, !3
         18        OP_DATA                                                  0
   67    19        ADD                                              ~18     !3, 1
         20        FETCH_OBJ_IS                                     ~17     'register'
         21        ISSET_ISEMPTY_DIM_OBJ                         0          ~17, ~18
         22      > JMPZ                                                     ~19, ->28
   68    23    >   ADD                                              ~21     !3, 1
         24        FETCH_OBJ_RW                                     $20     'register'
         25        FETCH_DIM_RW                                     $22     $20, ~21
         26        PRE_INC                                                  $22
         27      > JMP                                                      ->47
   70    28    >   FETCH_OBJ_R                                      ~24     'max_places'
         29      > JMPZ_EX                                          ~24     ~24, ->36
         30    >   FETCH_OBJ_R                                      ~25     'register'
         31        COUNT                                            ~26     ~25
         32        ADD                                              ~27     ~26, 1
         33        FETCH_OBJ_R                                      ~28     'max_places'
         34        IS_SMALLER                                       ~29     ~28, ~27
         35        BOOL                                             ~24     ~29
         36    > > JMPZ_EX                                          ~24     ~24, ->39
         37    >   BOOL_NOT                                         ~30     !0
         38        BOOL                                             ~24     ~30
         39    > > JMPZ                                                     ~24, ->43
   71    40    >   ASSIGN_OBJ                                               'register'
         41        OP_DATA                                                  !1
   72    42      > RETURN                                                   null
   74    43    >   ADD                                              ~33     !3, 1
         44        FETCH_OBJ_W                                      $32     'register'
         45        ASSIGN_DIM                                               $32, ~33
         46        OP_DATA                                                  0
   64    47    >   PRE_INC                                                  !3
         48    >   FETCH_OBJ_R                                      ~36     'register'
         49        COUNT                                            ~37     ~36
         50        IS_SMALLER                                               !3, ~37
         51      > JMPNZ                                                    ~38, ->11
   78    52    > > RETURN                                                   null

End of function iterate

Function readmeter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
Branch analysis from position: 2
filename:       /in/VjrZZ
function name:  readMeter
number of ops:  15
compiled vars:  !0 = $i, !1 = $meter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   81     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->9
   82     2    >   FETCH_OBJ_R                                      ~5      'register'
          3        FETCH_DIM_R                                      ~6      ~5, !0
          4        FETCH_OBJ_R                                      ~4      'values'
          5        FETCH_DIM_R                                      ~7      ~4, ~6
          6        ASSIGN_DIM                                               !1, !0
          7        OP_DATA                                                  ~7
   81     8        PRE_INC                                                  !0
          9    >   FETCH_OBJ_R                                      ~9      'register'
         10        COUNT                                            ~10     ~9
         11        IS_SMALLER                                               !0, ~10
         12      > JMPNZ                                                    ~11, ->2
   84    13    > > RETURN                                                   !1
   85    14*     > RETURN                                                   null

End of function readmeter

Function printmeter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VjrZZ
function name:  printMeter
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   89     0  E >   INIT_FCALL                                               'implode'
          1        SEND_VAL                                                 '%5D%5B'
          2        INIT_FCALL                                               'array_reverse'
          3        INIT_METHOD_CALL                                         'readMeter'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                         $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                         $2      
          9        CONCAT                                           ~3      '%5B', $2
         10        CONCAT                                           ~4      ~3, '%5D'
         11        CONCAT                                           ~5      ~4, '%0A'
         12      > RETURN                                                   ~5
   90    13*     > RETURN                                                   null

End of function printmeter

End of class Odometer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.03 ms | 1408 KiB | 27 Q