3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyEmpty { public $state; public function check(&$var) { $this->state = empty($var); return $this; } public function _or(&$var) { if($this->state) return $this; $this->state = $state || empty($var); return $this; } public function _and(&$var) { if(!$this->state) return $this; $this->state = $state && empty($var); return $this; } } $empty = new MyEmpty; $var = 'some'; var_dump($empty->check($foo['bar'])->_or($var)->state); var_dump($empty->check($foo['bar'])->_and($var)->state);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C31S6
function name:  (null)
number of ops:  29
compiled vars:  !0 = $empty, !1 = $var, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $3      'MyEmpty'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   28     3        ASSIGN                                                   !1, 'some'
   30     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'check'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_DIM_FUNC_ARG                               $7      !2, 'bar'
          8        SEND_FUNC_ARG                                            $7
          9        DO_FCALL                                      0  $8      
         10        INIT_METHOD_CALL                                         $8, '_or'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $9      
         13        FETCH_OBJ_R                                      ~10     $9, 'state'
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                                 
   31    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'check'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $12     !2, 'bar'
         20        SEND_FUNC_ARG                                            $12
         21        DO_FCALL                                      0  $13     
         22        INIT_METHOD_CALL                                         $13, '_and'
         23        SEND_VAR_EX                                              !1
         24        DO_FCALL                                      0  $14     
         25        FETCH_OBJ_R                                      ~15     $14, 'state'
         26        SEND_VAL                                                 ~15
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Class MyEmpty:
Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C31S6
function name:  check
number of ops:  7
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ISSET_ISEMPTY_CV                                 ~2      !0
          2        ASSIGN_OBJ                                               'state'
          3        OP_DATA                                                  ~2
    7     4        FETCH_THIS                                       ~3      
          5      > RETURN                                                   ~3
    8     6*     > RETURN                                                   null

End of function check

Function _or:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/C31S6
function name:  _or
number of ops:  13
compiled vars:  !0 = $var, !1 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~2      'state'
          2      > JMPZ                                                     ~2, ->5
   12     3    >   FETCH_THIS                                       ~3      
          4      > RETURN                                                   ~3
   14     5    > > JMPNZ_EX                                         ~5      !1, ->8
          6    >   ISSET_ISEMPTY_CV                                 ~6      !0
          7        BOOL                                             ~5      ~6
          8    >   ASSIGN_OBJ                                               'state'
          9        OP_DATA                                                  ~5
   15    10        FETCH_THIS                                       ~7      
         11      > RETURN                                                   ~7
   16    12*     > RETURN                                                   null

End of function _or

Function _and:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/C31S6
function name:  _and
number of ops:  14
compiled vars:  !0 = $var, !1 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        FETCH_OBJ_R                                      ~2      'state'
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->6
   20     4    >   FETCH_THIS                                       ~4      
          5      > RETURN                                                   ~4
   22     6    > > JMPZ_EX                                          ~6      !1, ->9
          7    >   ISSET_ISEMPTY_CV                                 ~7      !0
          8        BOOL                                             ~6      ~7
          9    >   ASSIGN_OBJ                                               'state'
         10        OP_DATA                                                  ~6
   23    11        FETCH_THIS                                       ~8      
         12      > RETURN                                                   ~8
   24    13*     > RETURN                                                   null

End of function _and

End of class MyEmpty.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.82 ms | 1400 KiB | 15 Q