3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Server { private $hostname; private $cpu; private $ram; public function __construct($hostname, $cpu, $ram) { $this->hostname = $hostname; $this->cpu = $cpu; $this->ram = $ram; } public function getHostname() { return $this->hostname; } public function setHostname($hostname) { return $this->hostname = ($hostname == null ? $this->_exception("Hostname must not be null.") : $hostname); } public function getCpu() { return $this->cpu; } public function setCpu($cpu) { return $this->cpu = ($cpu == null ? $this->_exception("CPU must not be null.") : $cpu); } public function getRam() { return $this->ram; } public function setRam($ram) { return $this->ram = ($ram == null ? $this->_exception("RAM must not be null.") : $ram); } public function getRamInGb() { return $this->ram / 1024; } public function addRam($ram) { return $this->ram = ($ram === null ? $this->_exception("RAM must not be null.") : $this->ram + $ram); } public function subRam($ram) { return $this->ram = ($this->ram - $ram < 0 ? $this->_exception("RAM must not result in a below-zero value.") : $this->ram - $ram); } protected function _exception($text = null) { throw new InvalidArgumentException($text); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   64     0  E > > RETURN                                                   1

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

End of function __construct

Function gethostname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  getHostname
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'hostname'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function gethostname

Function sethostname:
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 = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  setHostname
number of ops:  13
compiled vars:  !0 = $hostname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        IS_EQUAL                                                 !0, null
          2      > JMPZ                                                     ~2, ->8
          3    >   INIT_METHOD_CALL                                         '_exception'
          4        SEND_VAL_EX                                              'Hostname+must+not+be+null.'
          5        DO_FCALL                                      0  $3      
          6        QM_ASSIGN                                        ~4      $3
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~4      !0
          9    >   ASSIGN_OBJ                                       ~1      'hostname'
         10        OP_DATA                                                  ~4
         11      > RETURN                                                   ~1
   23    12*     > RETURN                                                   null

End of function sethostname

Function getcpu:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  getCpu
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'cpu'
          1      > RETURN                                                   ~0
   28     2*     > RETURN                                                   null

End of function getcpu

Function setcpu:
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 = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  setCpu
number of ops:  13
compiled vars:  !0 = $cpu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   32     1        IS_EQUAL                                                 !0, null
          2      > JMPZ                                                     ~2, ->8
          3    >   INIT_METHOD_CALL                                         '_exception'
          4        SEND_VAL_EX                                              'CPU+must+not+be+null.'
          5        DO_FCALL                                      0  $3      
          6        QM_ASSIGN                                        ~4      $3
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~4      !0
          9    >   ASSIGN_OBJ                                       ~1      'cpu'
         10        OP_DATA                                                  ~4
         11      > RETURN                                                   ~1
   33    12*     > RETURN                                                   null

End of function setcpu

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

End of function getram

Function setram:
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 = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  setRam
number of ops:  13
compiled vars:  !0 = $ram
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        IS_EQUAL                                                 !0, null
          2      > JMPZ                                                     ~2, ->8
          3    >   INIT_METHOD_CALL                                         '_exception'
          4        SEND_VAL_EX                                              'RAM+must+not+be+null.'
          5        DO_FCALL                                      0  $3      
          6        QM_ASSIGN                                        ~4      $3
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~4      !0
          9    >   ASSIGN_OBJ                                       ~1      'ram'
         10        OP_DATA                                                  ~4
         11      > RETURN                                                   ~1
   43    12*     > RETURN                                                   null

End of function setram

Function getramingb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  getRamInGb
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   FETCH_OBJ_R                                      ~0      'ram'
          1        DIV                                              ~1      ~0, 1024
          2      > RETURN                                                   ~1
   48     3*     > RETURN                                                   null

End of function getramingb

Function addram:
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 = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  addRam
number of ops:  15
compiled vars:  !0 = $ram
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
   52     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~2, ->8
          3    >   INIT_METHOD_CALL                                         '_exception'
          4        SEND_VAL_EX                                              'RAM+must+not+be+null.'
          5        DO_FCALL                                      0  $3      
          6        QM_ASSIGN                                        ~4      $3
          7      > JMP                                                      ->11
          8    >   FETCH_OBJ_R                                      ~5      'ram'
          9        ADD                                              ~6      ~5, !0
         10        QM_ASSIGN                                        ~4      ~6
         11    >   ASSIGN_OBJ                                       ~1      'ram'
         12        OP_DATA                                                  ~4
         13      > RETURN                                                   ~1
   53    14*     > RETURN                                                   null

End of function addram

Function subram:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3eufT
function name:  subRam
number of ops:  17
compiled vars:  !0 = $ram
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
   57     1        FETCH_OBJ_R                                      ~2      'ram'
          2        SUB                                              ~3      ~2, !0
          3        IS_SMALLER                                               ~3, 0
          4      > JMPZ                                                     ~4, ->10
          5    >   INIT_METHOD_CALL                                         '_exception'
          6        SEND_VAL_EX                                              'RAM+must+not+result+in+a+below-zero+value.'
          7        DO_FCALL                                      0  $5      
          8        QM_ASSIGN                                        ~6      $5
          9      > JMP                                                      ->13
         10    >   FETCH_OBJ_R                                      ~7      'ram'
         11        SUB                                              ~8      ~7, !0
         12        QM_ASSIGN                                        ~6      ~8
         13    >   ASSIGN_OBJ                                       ~1      'ram'
         14        OP_DATA                                                  ~6
         15      > RETURN                                                   ~1
   58    16*     > RETURN                                                   null

End of function subram

Function _exception:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/3eufT
function name:  _exception
number of ops:  6
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV_INIT                                        !0      null
   62     1        NEW                                              $1      'InvalidArgumentException'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
   63     5*     > RETURN                                                   null

End of function _exception

End of class Server.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.75 ms | 1407 KiB | 13 Q