3v4l.org

run code in 300+ PHP versions simultaneously
<?php function permission($filename) { $perms = fileperms($filename); if (($perms & 0xC000) == 0xC000) { $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { $info = 'p'; } else { $info = 'u'; } // владелец $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // группа $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // все $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function dir_list($dir) { if ($dir[strlen($dir)-1] != '/') $dir .= '/'; if (!is_dir($dir)) return array(); $dir_handle = opendir($dir); $dir_objects = array(); while ($object = readdir($dir_handle)) if (!in_array($object, array('.','..'))) { $filename = $dir . $object; $file_object = array( 'name' => $object, 'size' => filesize($filename), 'perm' => permission($filename), 'type' => filetype($filename), 'time' => date("d F Y H:i:s", filemtime($filename)) ); $dir_objects[] = $file_object; } return $dir_objects; } // print_r(dir_list('/tmp')); echo file_get_contents("/etc/php.ini"); echo file_get_contents("/etc/php/php.ini");
Output for 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
[PHP] ; proc_open is in here because resources somehow leak if not proc_closed ; ini_set should be in here too if you're concerned about security disable_functions = proc_open,phpinfo,mail open_basedir = /tmp:/in:/etc max_execution_time = 3 memory_limit = 64M enable_dl = Off ; for consistency of older versions allow_call_time_pass_reference = Off html_errors = Off extension=gmp.so extension=iconv.so extension=intl.so extension=bcmath.so ; extension=sodium.so zend_extension=opcache.so ; show all errors by default, if we'd lower this in the script we'll miss some parser notices error_reporting = -1 display_errors = On display_startup_errors = On log_errors = Off report_memleaks = On ; off in all any default php.ini short_open_tag = Off [Date] date.timezone = Europe/Amsterdam Warning: file_get_contents(/etc/php/php.ini): Failed to open stream: No such file or directory in /in/HrYqA on line 61
Output for 8.0.0 - 8.0.13
Warning: file_get_contents(/etc/php.ini): Failed to open stream: No such file or directory in /in/HrYqA on line 60 Warning: file_get_contents(/etc/php/php.ini): Failed to open stream: No such file or directory in /in/HrYqA on line 61
Output for 7.4.26 - 7.4.33
[PHP] ; proc_open is in here because resources somehow leak if not proc_closed ; ini_set should be in here too if you're concerned about security disable_functions = proc_open,phpinfo,mail open_basedir = /tmp:/in:/etc max_execution_time = 3 memory_limit = 64M enable_dl = Off ; for consistency of older versions allow_call_time_pass_reference = Off html_errors = Off extension=gmp.so extension=iconv.so extension=intl.so extension=bcmath.so ; extension=sodium.so zend_extension=opcache.so ; show all errors by default, if we'd lower this in the script we'll miss some parser notices error_reporting = -1 display_errors = On display_startup_errors = On log_errors = Off report_memleaks = On ; off in all any default php.ini short_open_tag = Off [Date] date.timezone = Europe/Amsterdam Warning: file_get_contents(/etc/php/php.ini): failed to open stream: No such file or directory in /in/HrYqA on line 61
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25
Warning: file_get_contents(/etc/php.ini): failed to open stream: No such file or directory in /in/HrYqA on line 60 Warning: file_get_contents(/etc/php/php.ini): failed to open stream: No such file or directory in /in/HrYqA on line 61
Output for 4.4.3 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Warning</b>: file_get_contents(/etc/php.ini) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in <b>/in/HrYqA</b> on line <b>60</b><br /> <br /> <b>Warning</b>: file_get_contents(/etc/php/php.ini) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in <b>/in/HrYqA</b> on line <b>61</b><br />
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.2
<br /> <b>Warning</b>: file_get_contents(/etc/php.ini): failed to open stream: No such file or directory in <b>/in/HrYqA</b> on line <b>60</b><br /> <br /> <b>Warning</b>: file_get_contents(/etc/php/php.ini): failed to open stream: No such file or directory in <b>/in/HrYqA</b> on line <b>61</b><br />
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: file_get_contents(/etc/php.ini) [<a href='http://www.php.net/function.file-get-contents'>function.file-get-contents</a>]: failed to create stream: No such file or directory in <b>/in/HrYqA</b> on line <b>60</b><br /> <br /> <b>Warning</b>: file_get_contents(/etc/php/php.ini) [<a href='http://www.php.net/function.file-get-contents'>function.file-get-contents</a>]: failed to create stream: No such file or directory in <b>/in/HrYqA</b> on line <b>61</b><br />

preferences:
324.94 ms | 402 KiB | 468 Q