3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tester { private $code = 0; static private $instance; private function __construct() { } static public function getInstance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } private $errors = array(); public function addError($txt, $code = 1) { $this->errors[] = ['txt' => $txt, 'code' => $code, 'tm' => date('Y-m-d H:i:s')]; if ($this->code === 0) { $this->code = $code; } } public function countErrors() { return count($this->errors); } public function valid() { return empty($this->errors) ? '0' : ($this->code != 0 ? $this->code : '999'); } public function showErrors() { return print_r($this->errors,1); } public function __toString() { return $this->showErrors(); } } $tester = Tester::getInstance(); $s = serialize($tester); $d = deserialize($s); var_dump($d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  (null)
number of ops:  16
compiled vars:  !0 = $tester, !1 = $s, !2 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'tester'
   53     1        INIT_STATIC_METHOD_CALL                                  'Tester', 'getInstance'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   56     4        INIT_FCALL                                               'serialize'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   58     8        INIT_FCALL_BY_NAME                                       'deserialize'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $7      
         11        ASSIGN                                                   !2, $7
   60    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class Tester:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/T32Nn
function name:  getInstance
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->7
   18     3    >   NEW                          self                $3      
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instance'
          6        OP_DATA                                                  $3
   22     7    >   FETCH_STATIC_PROP_R          unknown             ~5      'instance'
          8      > RETURN                                                   ~5
   23     9*     > RETURN                                                   null

End of function getinstance

Function adderror:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/T32Nn
function name:  addError
number of ops:  17
compiled vars:  !0 = $txt, !1 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      1
   28     2        INIT_ARRAY                                       ~4      !0, 'txt'
          3        ADD_ARRAY_ELEMENT                                ~4      !1, 'code'
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        DO_ICALL                                         $5      
          7        ADD_ARRAY_ELEMENT                                ~4      $5, 'tm'
          8        FETCH_OBJ_W                                      $2      'errors'
          9        ASSIGN_DIM                                               $2
         10        OP_DATA                                                  ~4
   29    11        FETCH_OBJ_R                                      ~6      'code'
         12        IS_IDENTICAL                                             ~6, 0
         13      > JMPZ                                                     ~7, ->16
   30    14    >   ASSIGN_OBJ                                               'code'
         15        OP_DATA                                                  !1
   32    16    > > RETURN                                                   null

End of function adderror

Function counterrors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  countErrors
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   FETCH_OBJ_R                                      ~0      'errors'
          1        COUNT                                            ~1      ~0
          2      > RETURN                                                   ~1
   37     3*     > RETURN                                                   null

End of function counterrors

Function valid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  valid
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'errors'
          1      > JMPZ                                                     ~0, ->4
          2    >   QM_ASSIGN                                        ~1      '0'
          3      > JMP                                                      ->12
          4    >   FETCH_OBJ_R                                      ~2      'code'
          5        IS_NOT_EQUAL                                             ~2, 0
          6      > JMPZ                                                     ~3, ->10
          7    >   FETCH_OBJ_R                                      ~4      'code'
          8        QM_ASSIGN                                        ~5      ~4
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~5      '999'
         11    >   QM_ASSIGN                                        ~1      ~5
         12    > > RETURN                                                   ~1
   41    13*     > RETURN                                                   null

End of function valid

Function showerrors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  showErrors
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   INIT_FCALL                                               'print_r'
          1        FETCH_OBJ_R                                      ~0      'errors'
          2        SEND_VAL                                                 ~0
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   46     6*     > RETURN                                                   null

End of function showerrors

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T32Nn
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   INIT_METHOD_CALL                                         'showErrors'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   51     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

End of class Tester.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.65 ms | 1404 KiB | 21 Q