3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { function n($n, $return_method = false) { if ($return_method) return __FUNCTION__; return "N is $n"; } } $test = new Test; $method = $test->n(5, true); print $method . PHP_EOL; print $test->$method(5) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X42fU
function name:  (null)
number of ops:  16
compiled vars:  !0 = $test, !1 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'n'
          4        SEND_VAL_EX                                              5
          5        SEND_VAL_EX                                              <true>
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   12     8        CONCAT                                           ~7      !1, '%0A'
          9        ECHO                                                     ~7
   13    10        INIT_METHOD_CALL                                         !0, !1
         11        SEND_VAL_EX                                              5
         12        DO_FCALL                                      0  $8      
         13        CONCAT                                           ~9      $8, '%0A'
         14        ECHO                                                     ~9
   14    15      > RETURN                                                   1

Class Test:
Function n:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X42fU
function name:  n
number of ops:  8
compiled vars:  !0 = $n, !1 = $return_method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    5     2      > JMPZ                                                     !1, ->4
    6     3    > > RETURN                                                   'n'
    7     4    >   NOP                                                      
          5        FAST_CONCAT                                      ~2      'N+is+', !0
          6      > RETURN                                                   ~2
    8     7*     > RETURN                                                   null

End of function n

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.71 ms | 1398 KiB | 13 Q