3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Forms { private $_age, $_year; public function setAge($age) { $this->_age = $age; } public function getAge() { return (is_null($this->_age) || !is_int($this->_age)) ? null : $this->_age; } } test(21); test('test'); test(null); function test($set_to) { $form = new Forms(); $form->setAge($set_to); if($age = $form->getAge()) { echo 'Age is '.$age.'</br>'; } else { echo 'Age is not valid (null or non-int)</br>'; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQDdH
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL_BY_NAME                                       'test'
          1        SEND_VAL_EX                                              21
          2        DO_FCALL                                      0          
   15     3        INIT_FCALL_BY_NAME                                       'test'
          4        SEND_VAL_EX                                              'test'
          5        DO_FCALL                                      0          
   16     6        INIT_FCALL_BY_NAME                                       'test'
          7        SEND_VAL_EX                                              null
          8        DO_FCALL                                      0          
   26     9      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQDdH
function name:  test
number of ops:  17
compiled vars:  !0 = $set_to, !1 = $form, !2 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        NEW                                              $3      'Forms'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   20     4        INIT_METHOD_CALL                                         !1, 'setAge'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   21     7        INIT_METHOD_CALL                                         !1, 'getAge'
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                           ~8      !2, $7
         10      > JMPZ                                                     ~8, ->15
   22    11    >   CONCAT                                           ~9      'Age+is+', !2
         12        CONCAT                                           ~10     ~9, '%3C%2Fbr%3E'
         13        ECHO                                                     ~10
   21    14      > JMP                                                      ->16
   24    15    >   ECHO                                                     'Age+is+not+valid+%28null+or+non-int%29%3C%2Fbr%3E'
   26    16    > > RETURN                                                   null

End of function test

Class Forms:
Function setage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BQDdH
function name:  setAge
number of ops:  4
compiled vars:  !0 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               '_age'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function setage

Function getage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
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: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/BQDdH
function name:  getAge
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      '_age'
          1        TYPE_CHECK                                    2  ~1      ~0
          2      > JMPNZ_EX                                         ~1      ~1, ->7
          3    >   FETCH_OBJ_R                                      ~2      '_age'
          4        TYPE_CHECK                                   16  ~3      ~2
          5        BOOL_NOT                                         ~4      ~3
          6        BOOL                                             ~1      ~4
          7    > > JMPZ                                                     ~1, ->10
          8    >   QM_ASSIGN                                        ~5      null
          9      > JMP                                                      ->12
         10    >   FETCH_OBJ_R                                      ~6      '_age'
         11        QM_ASSIGN                                        ~5      ~6
         12    > > RETURN                                                   ~5
   11    13*     > RETURN                                                   null

End of function getage

End of class Forms.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
265.15 ms | 1007 KiB | 13 Q