3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $item; public function __construct ($item) { $this->item = $item; } public function gerade ($var) { return (($this->item % $var) === 0); } } $baz = []; $array2 = array(6, 7, 8, 9, 10, 11, 12); $bar = new Foo(3); foreach ($array2 as $var){ die(var_dump($bar->gerade($var))); if($bar->gerade($var)) $baz = array_merge($baz, $var); } print_r($baz);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/DL66Z
function name:  (null)
number of ops:  30
compiled vars:  !0 = $baz, !1 = $array2, !2 = $bar, !3 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   14     2        NEW                                              $6      'Foo'
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $6
   15     6      > FE_RESET_R                                       $9      !1, ->25
          7    > > FE_FETCH_R                                               $9, !3, ->25
   16     8    >   INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !2, 'gerade'
         10        SEND_VAR_EX                                              !3
         11        DO_FCALL                                      0  $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                         $11     
         14      > EXIT                                                     $11
   17    15*       INIT_METHOD_CALL                                         !2, 'gerade'
         16*       SEND_VAR_EX                                              !3
         17*       DO_FCALL                                      0  $12     
         18*       JMPZ                                                     $12, ->24
   18    19*       INIT_FCALL                                               'array_merge'
         20*       SEND_VAR                                                 !0
         21*       SEND_VAR                                                 !3
         22*       DO_ICALL                                         $13     
         23*       ASSIGN                                                   !0, $13
   15    24*       JMP                                                      ->7
         25    >   FE_FREE                                                  $9
   21    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

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

End of function __construct

Function gerade:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DL66Z
function name:  gerade
number of ops:  6
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_OBJ_R                                      ~1      'item'
          2        MOD                                              ~2      ~1, !0
          3        IS_IDENTICAL                                     ~3      ~2, 0
          4      > RETURN                                                   ~3
   10     5*     > RETURN                                                   null

End of function gerade

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.11 ms | 1400 KiB | 19 Q