3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo { final public static function FlipFlop() { return (bool) mt_rand(0, 1); } } // Dit werkt $bar = Foo::FlipFlop(); var_dump($bar); // Dit werkt niet $baz = new Foo(); $bar = $baz->FlipFlop();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42e3e
function name:  (null)
number of ops:  13
compiled vars:  !0 = $bar, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'FlipFlop'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   12     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   15     6        NEW                                              $5      'Foo'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
   16     9        INIT_METHOD_CALL                                         !1, 'FlipFlop'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !0, $8
         12      > RETURN                                                   1

Class Foo:
Function flipflop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42e3e
function name:  FlipFlop
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'mt_rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $0      
          4        BOOL                                             ~1      $0
          5      > RETURN                                                   ~1
    7     6*     > RETURN                                                   null

End of function flipflop

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.17 ms | 1386 KiB | 17 Q