3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 使用表格浏览目录的结构 print("<TABLE BORDER=\"1\">\n"); // 创建表格的头 print("<TR><font bgcolor='red'>\n"); print("<TH><font color='red' size=3 >文件名</font></TH>\n"); print("<TH><font color='red' size=3 >文件的大小</font></TH>\n"); print("</font></TR>\n"); $myDirectory = opendir("."); // 建立操作目录的句柄 // 读出目录中的每一个子项 while($entryName = readdir($myDirectory)) { print("<TR>"); print("<TD>$entryName</TD>"); print("<TD ALIGN=\"right\">"); $size=filesize($entryName); if($size <1024) { $FileSize = (string)$size . "字节";} elseif($size <(1024 * 1024)) { $FileSize = number_format((double)($size / 1024), 2) . " KB"; } else { $FileSize = number_format((double)($size/(1024*1024)),2)."MB"; } print($FileSize); print("</TD>"); print("</TR>\n"); } closedir($myDirectory); // 关闭目录 print("</TABLE>\n");
Output for git.master, git.master_jit
<TABLE BORDER="1"> <TR><font bgcolor='red'> <TH><font color='red' size=3 >文件名</font></TH> <TH><font color='red' size=3 >文件的大小</font></TH> </font></TR> Warning: opendir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/rWbEQ on line 9 Warning: opendir(.): Failed to open directory: Operation not permitted in /in/rWbEQ on line 9 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /in/rWbEQ:11 Stack trace: #0 /in/rWbEQ(11): readdir(false) #1 {main} thrown in /in/rWbEQ on line 11
Process exited with code 255.
Output for rfc.property-hooks
<TABLE BORDER="1"> <TR><font bgcolor='red'> <TH><font color='red' size=3 >文件名</font></TH> <TH><font color='red' size=3 >文件的大小</font></TH> </font></TR> Warning: opendir(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/rWbEQ on line 9 Warning: opendir(.): Failed to open directory: Operation not permitted in /in/rWbEQ on line 9 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given in /in/rWbEQ:11 Stack trace: #0 /in/rWbEQ(11): readdir(false) #1 {main} thrown in /in/rWbEQ on line 11
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.94 ms | 402 KiB | 8 Q