3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function bar($new = null) { static $bar = 'foo'; if ($new !== null) { $bar = $new; } return $bar; } } $f = new Foo; echo $f->bar() . "\n"; $f->bar('bar'); echo $f->bar() . "\n"; echo (int)$f;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dn7P7
function name:  (null)
number of ops:  17
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $4      
          5        CONCAT                                           ~5      $4, '%0A'
          6        ECHO                                                     ~5
   20     7        INIT_METHOD_CALL                                         !0, 'bar'
          8        SEND_VAL_EX                                              'bar'
          9        DO_FCALL                                      0          
   21    10        INIT_METHOD_CALL                                         !0, 'bar'
         11        DO_FCALL                                      0  $7      
         12        CONCAT                                           ~8      $7, '%0A'
         13        ECHO                                                     ~8
   22    14        CAST                                          4  ~9      !0
         15        ECHO                                                     ~9
         16      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/Dn7P7
function name:  bar
number of ops:  7
compiled vars:  !0 = $new, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      null
    7     1        BIND_STATIC                                              !1
    9     2        TYPE_CHECK                                  1020          !0
          3      > JMPZ                                                     ~2, ->5
   10     4    >   ASSIGN                                                   !1, !0
   13     5    > > RETURN                                                   !1
   14     6*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.92 ms | 1394 KiB | 13 Q