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; $g = new Foo; echo $f->bar() . "\n"; $f->bar('bar'); echo $f->bar() . "\n"; echo (int)$f; echo (int)$g;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ugoJK
function name:  (null)
number of ops:  22
compiled vars:  !0 = $f, !1 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        NEW                                              $5      'Foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   20     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        DO_FCALL                                      0  $8      
          8        CONCAT                                           ~9      $8, '%0A'
          9        ECHO                                                     ~9
   21    10        INIT_METHOD_CALL                                         !0, 'bar'
         11        SEND_VAL_EX                                              'bar'
         12        DO_FCALL                                      0          
   22    13        INIT_METHOD_CALL                                         !0, 'bar'
         14        DO_FCALL                                      0  $11     
         15        CONCAT                                           ~12     $11, '%0A'
         16        ECHO                                                     ~12
   23    17        CAST                                          4  ~13     !0
         18        ECHO                                                     ~13
   24    19        CAST                                          4  ~14     !1
         20        ECHO                                                     ~14
         21      > 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/ugoJK
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:
157.89 ms | 1395 KiB | 13 Q