3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!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>
based on C90LA
Output for 7.0.0 - 7.1.0
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): RecursiveDirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for hhvm-3.12.0
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): RecursiveDirectoryIterator->__construct() #1 /in/89W5X(83): rChmod() #2 {main}
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.3 - 5.6.28
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): RecursiveDirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 5.1.2
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'RuntimeException' with message 'RecursiveDirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): RecursiveDirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 5.1.0 - 5.1.1
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'RuntimeException' with message 'DirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): DirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 5.0.5
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): DirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 5.0.3 - 5.0.4
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(54): RecursiveDirectoryIterator->__construct('/home/lettreaua...') #1 /in/89W5X(83): rChmod('/home/lettreaua...', 493, 420) #2 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 5.0.0 - 5.0.2
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(/home/lettreaua/www/ ): failed to open dir: No such file or directory' in /in/89W5X:54 Stack trace: #0 /in/89W5X(83): rChmod('/home/lettreaua...') #1 {main} thrown in /in/89W5X on line 54
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Cannot instantiate non-existent class: recursivedirectoryiterator in /in/89W5X on line 54
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<!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 --> <p style="margin-bottom: 0px"><b>Log:</b></p> <div id="logtext"> Fatal error: Cannot instantiate non-existent class: recursivedirectoryiterator in /in/89W5X on line 54