3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Wolfcast CHMOD Scriptlet</title> <meta name="description" content="Wolfcast CHMOD Scriptlet Version 1.0"> <meta name="author" content="Alexandre Valiquette (www.wolfcast.com)"> <style type="text/css"> div#logtext { width: 875px; height: 300px; overflow: auto; border: solid 1px black; } div#logtext p { white-space: nowrap; margin: 0px; } div#logtext p.success { color: #008000; } div#logtext p.error { color: #ff0000; } </style> </head> <body> <p> <big><b>Wolfcast CHMOD Scriptlet</b></big><br> <small>Version 1.0<br> <a href="http://www.wolfcast.com">www.wolfcast.com</a><br></small> </p> <!-- START - PHP generated output --> <?php //--------------------------------------------------------------------------- //rChmod will recursively CHMOD $dir and it's content to $dirModes for directories and to $fileModes for files. //$dirModes and $fileModes must start with 0 (755 become 0755 for instance). //rChmod returns the number of failed CHMOD operations. function rChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ) { $retval = 0; //Number of failed CHMOD operations echo "<p style=\"margin-bottom: 0px\"><b>Log:</b></p>\r\n<div id=\"logtext\">\r\n"; $d = new RecursiveDirectoryIterator( $dir ); foreach ( new RecursiveIteratorIterator( $d, 1 ) as $path ) { $chmodret = false; if ( $path->isDir() ) $chmodret = chmod( $path, $dirModes ); else if ( is_file( $path ) ) $chmodret = chmod( $path, $fileModes ); if ($chmodret) $pclassname = "success"; else { $pclassname = "error"; ++$retval; } echo "<p class=\"" . $pclassname . "\">" . $path . "</p>\r\n"; } echo "</div>\r\n"; return $retval; } //--------------------------------------------------------------------------- //Change the following line to fit your needs (path, directories CHMOD value, files CHMOD value). CHMOD values must start with 0. $nbfailed = rChmod( "/home/lettreaua/www/ ", 0755, 0644 ); echo "<p style=\"margin-top: 0px\"><b>"; if ($nbfailed > 0) { echo $nbfailed . " CHMOD operation(s) failed! See log above."; } else echo "No error encountered."; echo "</b></p>\r\n"; ?> <!-- END - PHP generated output --> <p> <img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Strict" height="31" width="88"> </p> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/89W5X
function name:  (null)
number of ops:  17
compiled vars:  !0 = $nbfailed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+HTML+4.01%2F%2FEN%22+%22http%3A%2F%2Fwww.w3.org%2FTR%2Fhtml4%2Fstrict.dtd%22%3E%0A%3Chtml%3E%0A%3Chead%3E%0A%3Cmeta+http-equiv%3D%22Content-Type%22+content%3D%22text%2Fhtml%3B+charset%3Dwindows-1252%22%3E%0A%3Ctitle%3EWolfcast+CHMOD+Scriptlet%3C%2Ftitle%3E%0A%3Cmeta+name%3D%22description%22+content%3D%22Wolfcast+CHMOD+Scriptlet+Version+1.0%22%3E%0A%3Cmeta+name%3D%22author%22+content%3D%22Alexandre+Valiquette+%28www.wolfcast.com%29%22%3E%0A%0A%3Cstyle+type%3D%22text%2Fcss%22%3E%0Adiv%23logtext%0A%7B%0Awidth%3A+875px%3B%0Aheight%3A+300px%3B%0Aoverflow%3A+auto%3B%0Aborder%3A+solid+1px+black%3B%0A%7D%0Adiv%23logtext+p%0A%7B%0Awhite-space%3A+nowrap%3B%0Amargin%3A+0px%3B%0A%7D%0Adiv%23logtext+p.success%0A%7B%0Acolor%3A+%23008000%3B%0A%7D%0Adiv%23logtext+p.error%0A%7B%0Acolor%3A+%23ff0000%3B%0A%7D%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%0A%3Cbody%3E%0A%0A%3Cp%3E%0A%3Cbig%3E%3Cb%3EWolfcast+CHMOD+Scriptlet%3C%2Fb%3E%3C%2Fbig%3E%3Cbr%3E%0A%3Csmall%3EVersion+1.0%3Cbr%3E%0A%3Ca+href%3D%22http%3A%2F%2Fwww.wolfcast.com%22%3Ewww.wolfcast.com%3C%2Fa%3E%3Cbr%3E%3C%2Fsmall%3E%0A%3C%2Fp%3E%0A%0A%3C%21--+START+-+PHP+generated+output+--%3E%0A'
   83     1        INIT_FCALL                                               'rchmod'
          2        SEND_VAL                                                 '%2Fhome%2Flettreaua%2Fwww%2F+'
          3        SEND_VAL                                                 493
          4        SEND_VAL                                                 420
          5        DO_FCALL                                      0  $1      
          6        ASSIGN                                                   !0, $1
   85     7        ECHO                                                     '%3Cp+style%3D%22margin-top%3A+0px%22%3E%3Cb%3E'
   86     8        IS_SMALLER                                               0, !0
          9      > JMPZ                                                     ~3, ->13
   88    10    >   CONCAT                                           ~4      !0, '+CHMOD+operation%28s%29+failed%21+See+log+above.'
         11        ECHO                                                     ~4
         12      > JMP                                                      ->14
   91    13    >   ECHO                                                     'No+error+encountered.'
   92    14    >   ECHO                                                     '%3C%2Fb%3E%3C%2Fp%3E%0D%0A'
   95    15        ECHO                                                     '%3C%21--+END+-+PHP+generated+output+--%3E%0A%0A%3Cp%3E%0A%3Cimg+src%3D%22http%3A%2F%2Fwww.w3.org%2FIcons%2Fvalid-html401%22+alt%3D%22Valid+HTML+4.01+Strict%22+height%3D%2231%22+width%3D%2288%22%3E%0A%3C%2Fp%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
  102    16      > RETURN                                                   1

Function rchmod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 45
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 45
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 34
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
Branch analysis from position: 34
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/89W5X
function name:  rChmod
number of ops:  49
compiled vars:  !0 = $dir, !1 = $dirModes, !2 = $fileModes, !3 = $retval, !4 = $d, !5 = $path, !6 = $chmodret, !7 = $pclassname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV_INIT                                        !0      '.%2F'
          1        RECV_INIT                                        !1      493
          2        RECV_INIT                                        !2      420
   51     3        ASSIGN                                                   !3, 0
   52     4        ECHO                                                     '%3Cp+style%3D%22margin-bottom%3A+0px%22%3E%3Cb%3ELog%3A%3C%2Fb%3E%3C%2Fp%3E%0D%0A%3Cdiv+id%3D%22logtext%22%3E%0D%0A'
   54     5        NEW                                              $9      'RecursiveDirectoryIterator'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !4, $9
   55     9        NEW                                              $12     'RecursiveIteratorIterator'
         10        SEND_VAR_EX                                              !4
         11        SEND_VAL_EX                                              1
         12        DO_FCALL                                      0          
         13      > FE_RESET_R                                       $14     $12, ->45
         14    > > FE_FETCH_R                                               $14, !5, ->45
   57    15    >   ASSIGN                                                   !6, <false>
   59    16        INIT_METHOD_CALL                                         !5, 'isDir'
         17        DO_FCALL                                      0  $16     
         18      > JMPZ                                                     $16, ->25
   60    19    >   INIT_FCALL                                               'chmod'
         20        SEND_VAR                                                 !5
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $17     
         23        ASSIGN                                                   !6, $17
         24      > JMP                                                      ->34
   62    25    >   INIT_FCALL                                               'is_file'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                         $19     
         28      > JMPZ                                                     $19, ->34
   63    29    >   INIT_FCALL                                               'chmod'
         30        SEND_VAR                                                 !5
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $20     
         33        ASSIGN                                                   !6, $20
   65    34    > > JMPZ                                                     !6, ->37
   66    35    >   ASSIGN                                                   !7, 'success'
         36      > JMP                                                      ->39
   69    37    >   ASSIGN                                                   !7, 'error'
   70    38        PRE_INC                                                  !3
   73    39    >   CONCAT                                           ~25     '%3Cp+class%3D%22', !7
         40        CONCAT                                           ~26     ~25, '%22%3E'
         41        CONCAT                                           ~27     ~26, !5
         42        CONCAT                                           ~28     ~27, '%3C%2Fp%3E%0D%0A'
         43        ECHO                                                     ~28
   55    44      > JMP                                                      ->14
         45    >   FE_FREE                                                  $14
   76    46        ECHO                                                     '%3C%2Fdiv%3E%0D%0A'
   77    47      > RETURN                                                   !3
   78    48*     > RETURN                                                   null

End of function rchmod

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.17 ms | 1407 KiB | 18 Q