3v4l.org

run code in 300+ PHP versions simultaneously
<?php function callableToString($callable) { $refFunc = new ReflectionFunction($callable); $startLine = $refFunc->getStartLine(); $endLine = $refFunc->getEndLine(); $f = fopen($refFunc->getFileName(), 'r'); $lineNo = 0; $methodBody = ''; while($line = fgets($f)) { $lineNo++; if($lineNo > $startLine) { $methodBody .= $line; } if($lineNo == $endLine - 1) { break; } } fclose($f); return $methodBody; } callableToString(function(){print "yes";});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r890J
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'callabletostring'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fr890J%3A26%240'
          2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function callabletostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 21
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 29
Branch analysis from position: 25
filename:       /in/r890J
function name:  callableToString
number of ops:  39
compiled vars:  !0 = $callable, !1 = $refFunc, !2 = $startLine, !3 = $endLine, !4 = $f, !5 = $lineNo, !6 = $methodBody, !7 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $8      'ReflectionFunction'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $8
    5     5        INIT_METHOD_CALL                                         !1, 'getStartLine'
          6        DO_FCALL                                      0  $11     
          7        ASSIGN                                                   !2, $11
    6     8        INIT_METHOD_CALL                                         !1, 'getEndLine'
          9        DO_FCALL                                      0  $13     
         10        ASSIGN                                                   !3, $13
    8    11        INIT_FCALL                                               'fopen'
         12        INIT_METHOD_CALL                                         !1, 'getFileName'
         13        DO_FCALL                                      0  $15     
         14        SEND_VAR                                                 $15
         15        SEND_VAL                                                 'r'
         16        DO_ICALL                                         $16     
         17        ASSIGN                                                   !4, $16
    9    18        ASSIGN                                                   !5, 0
   11    19        ASSIGN                                                   !6, ''
   12    20      > JMP                                                      ->29
   13    21    >   PRE_INC                                                  !5
   14    22        IS_SMALLER                                               !2, !5
         23      > JMPZ                                                     ~21, ->25
   15    24    >   ASSIGN_OP                                     8          !6, !7
   17    25    >   SUB                                              ~23     !3, 1
         26        IS_EQUAL                                                 !5, ~23
         27      > JMPZ                                                     ~24, ->29
   18    28    > > JMP                                                      ->34
   12    29    >   INIT_FCALL                                               'fgets'
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $25     
         32        ASSIGN                                           ~26     !7, $25
         33      > JMPNZ                                                    ~26, ->21
   21    34    >   INIT_FCALL                                               'fclose'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                                 
   23    37      > RETURN                                                   !6
   24    38*     > RETURN                                                   null

End of function callabletostring

Function %00%7Bclosure%7D%2Fin%2Fr890J%3A26%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r890J
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ECHO                                                     'yes'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fr890J%3A26%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.37 ms | 1403 KiB | 20 Q