3v4l.org

run code in 300+ PHP versions simultaneously
<?php class YourClassThatWouldHaveAMuchBetterNameIfWeKnewWhatItWasDoing { private $uploadDir; public function __construct(string $uploadDir) { $this->uploadDir = $uploadDir; } public function countFiles(): int { $dir = getcwd()."/".$this->uploadDir; $files = []; // glob($dir."*"); return $files === false ? 0 : count($files); } } $thingy = new YourClassThatWouldHaveAMuchBetterNameIfWeKnewWhatItWasDoing("/path/to/uploads"); var_dump( $thingy->countFiles() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PRCdf
function name:  (null)
number of ops:  10
compiled vars:  !0 = $thingy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'YourClassThatWouldHaveAMuchBetterNameIfWeKnewWhatItWasDoing'
          1        SEND_VAL_EX                                              '%2Fpath%2Fto%2Fuploads'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   23     4        INIT_FCALL                                               'var_dump'
   24     5        INIT_METHOD_CALL                                         !0, 'countFiles'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   25     9      > RETURN                                                   1

Class YourClassThatWouldHaveAMuchBetterNameIfWeKnewWhatItWasDoing:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PRCdf
function name:  __construct
number of ops:  4
compiled vars:  !0 = $uploadDir
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'uploadDir'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function countfiles:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PRCdf
function name:  countFiles
number of ops:  17
compiled vars:  !0 = $dir, !1 = $files
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'getcwd'
          1        DO_ICALL                                         $2      
          2        CONCAT                                           ~3      $2, '%2F'
          3        FETCH_OBJ_R                                      ~4      'uploadDir'
          4        CONCAT                                           ~5      ~3, ~4
          5        ASSIGN                                                   !0, ~5
   14     6        ASSIGN                                                   !1, <array>
   16     7        TYPE_CHECK                                    4          !1
          8      > JMPZ                                                     ~8, ->11
          9    >   QM_ASSIGN                                        ~9      0
         10      > JMP                                                      ->13
         11    >   COUNT                                            ~10     !1
         12        QM_ASSIGN                                        ~9      ~10
         13    >   VERIFY_RETURN_TYPE                                       ~9
         14      > RETURN                                                   ~9
   17    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function countfiles

End of class YourClassThatWouldHaveAMuchBetterNameIfWeKnewWhatItWasDoing.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.64 ms | 1404 KiB | 17 Q