3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class WorkUnitDataType { const NoneType = 0; const ArrayType = 1; const JsonType = 2; const UrlType = 3; const FileType = 4; private $value; private $name; protected function __construct($input) { if (is_int($input)) { $this->setByValue($input); } else if (is_string($input)) { $this->setByName($input); } } protected function setByValue($value) { if (is_int($value)) { $this->value = $value; $this->name = WorkUnitDataType::toString($value); } } protected function setByName($name) { if (is_) $this->value = WorkUnitDataType::toString($name); $this->name = $name; } public static function toString($const) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($value == $const) { return $name; } } return Null; } public static function toValue($text) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($name == $text) { return $value; } } return -1; } } class NoneType extends WorkUnitDataType { public function __construct() { parent::__construct(get_class($this)); } } $a = new NoneType(); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iLTUI
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   70     0  E >   NEW                                              $1      'NoneType'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   71     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Class WorkUnitDataType:
Function __construct:
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 = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/iLTUI
function name:  __construct
number of ops:  13
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        TYPE_CHECK                                   16          !0
          2      > JMPZ                                                     ~1, ->7
   15     3    >   INIT_METHOD_CALL                                         'setByValue'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6      > JMP                                                      ->12
   16     7    >   TYPE_CHECK                                   64          !0
          8      > JMPZ                                                     ~3, ->12
   17     9    >   INIT_METHOD_CALL                                         'setByName'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
   21    12    > > RETURN                                                   null

End of function __construct

Function setbyvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/iLTUI
function name:  setByValue
number of ops:  11
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        TYPE_CHECK                                   16          !0
          2      > JMPZ                                                     ~1, ->10
   25     3    >   ASSIGN_OBJ                                               'value'
          4        OP_DATA                                                  !0
   26     5        INIT_STATIC_METHOD_CALL                                  'WorkUnitDataType', 'toString'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        ASSIGN_OBJ                                               'name'
          9        OP_DATA                                                  $4
   28    10    > > RETURN                                                   null

End of function setbyvalue

Function setbyname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/iLTUI
function name:  setByName
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        FETCH_CONSTANT                                   ~1      'is_'
          2      > JMPZ                                                     ~1, ->8
   32     3    >   INIT_STATIC_METHOD_CALL                                  'WorkUnitDataType', 'toString'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN_OBJ                                               'value'
          7        OP_DATA                                                  $3
   33     8    >   ASSIGN_OBJ                                               'name'
          9        OP_DATA                                                  !0
   34    10      > RETURN                                                   null

End of function setbyname

Function tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/iLTUI
function name:  toString
number of ops:  19
compiled vars:  !0 = $const, !1 = $class, !2 = $constants, !3 = $value, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        NEW                                              $5      'ReflectionClass'
          2        SEND_VAL_EX                                              'WorkUnitDataType'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   38     5        INIT_METHOD_CALL                                         !1, 'getConstants'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   40     8      > FE_RESET_R                                       $10     !2, ->16
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->16
         10    >   ASSIGN                                                   !4, ~11
   41    11        IS_EQUAL                                                 !3, !0
         12      > JMPZ                                                     ~13, ->15
   42    13    >   FE_FREE                                                  $10
         14      > RETURN                                                   !4
   40    15    > > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   46    17      > RETURN                                                   null
   47    18*     > RETURN                                                   null

End of function tostring

Function tovalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/iLTUI
function name:  toValue
number of ops:  19
compiled vars:  !0 = $text, !1 = $class, !2 = $constants, !3 = $value, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   50     1        NEW                                              $5      'ReflectionClass'
          2        SEND_VAL_EX                                              'WorkUnitDataType'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   51     5        INIT_METHOD_CALL                                         !1, 'getConstants'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   53     8      > FE_RESET_R                                       $10     !2, ->16
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->16
         10    >   ASSIGN                                                   !4, ~11
   54    11        IS_EQUAL                                                 !4, !0
         12      > JMPZ                                                     ~13, ->15
   55    13    >   FE_FREE                                                  $10
         14      > RETURN                                                   !3
   53    15    > > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   59    17      > RETURN                                                   -1
   60    18*     > RETURN                                                   null

End of function tovalue

End of class WorkUnitDataType.

Class NoneType:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iLTUI
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        FETCH_THIS                                       ~0      
          2        GET_CLASS                                        ~1      ~0
          3        SEND_VAL_EX                                              ~1
          4        DO_FCALL                                      0          
   66     5      > RETURN                                                   null

End of function __construct

Function setbyvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/iLTUI
function name:  setByValue
number of ops:  11
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        TYPE_CHECK                                   16          !0
          2      > JMPZ                                                     ~1, ->10
   25     3    >   ASSIGN_OBJ                                               'value'
          4        OP_DATA                                                  !0
   26     5        INIT_STATIC_METHOD_CALL                                  'WorkUnitDataType', 'toString'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        ASSIGN_OBJ                                               'name'
          9        OP_DATA                                                  $4
   28    10    > > RETURN                                                   null

End of function setbyvalue

Function setbyname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/iLTUI
function name:  setByName
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        FETCH_CONSTANT                                   ~1      'is_'
          2      > JMPZ                                                     ~1, ->8
   32     3    >   INIT_STATIC_METHOD_CALL                                  'WorkUnitDataType', 'toString'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN_OBJ                                               'value'
          7        OP_DATA                                                  $3
   33     8    >   ASSIGN_OBJ                                               'name'
          9        OP_DATA                                                  !0
   34    10      > RETURN                                                   null

End of function setbyname

Function tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/iLTUI
function name:  toString
number of ops:  19
compiled vars:  !0 = $const, !1 = $class, !2 = $constants, !3 = $value, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        NEW                                              $5      'ReflectionClass'
          2        SEND_VAL_EX                                              'WorkUnitDataType'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   38     5        INIT_METHOD_CALL                                         !1, 'getConstants'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   40     8      > FE_RESET_R                                       $10     !2, ->16
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->16
         10    >   ASSIGN                                                   !4, ~11
   41    11        IS_EQUAL                                                 !3, !0
         12      > JMPZ                                                     ~13, ->15
   42    13    >   FE_FREE                                                  $10
         14      > RETURN                                                   !4
   40    15    > > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   46    17      > RETURN                                                   null
   47    18*     > RETURN                                                   null

End of function tostring

Function tovalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/iLTUI
function name:  toValue
number of ops:  19
compiled vars:  !0 = $text, !1 = $class, !2 = $constants, !3 = $value, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   50     1        NEW                                              $5      'ReflectionClass'
          2        SEND_VAL_EX                                              'WorkUnitDataType'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   51     5        INIT_METHOD_CALL                                         !1, 'getConstants'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   53     8      > FE_RESET_R                                       $10     !2, ->16
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->16
         10    >   ASSIGN                                                   !4, ~11
   54    11        IS_EQUAL                                                 !4, !0
         12      > JMPZ                                                     ~13, ->15
   55    13    >   FE_FREE                                                  $10
         14      > RETURN                                                   !3
   53    15    > > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   59    17      > RETURN                                                   -1
   60    18*     > RETURN                                                   null

End of function tovalue

End of class NoneType.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
268.43 ms | 1412 KiB | 16 Q