3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/html; charset=utf-8"); function varInfo($display, $var) { echo '<b>==========' . $display . '===========</b><br />'; echo '<pre>'; var_dump($var); echo '</pre>'; } if (isset($_POST['submit'])) { varInfo('files', $_FILES['files']); $files = $_FILES['files']; $count = count($files['name']); for ($i = 0; $i < $count; $i++) { $name = $files['name'][$i]; $tmpName = $files['tmp_name'][$i]; $error = $files['error'][$i]; $size = $files['size'][$i]; $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); varInfo('name', $name); varInfo('tmpName', $tmpName); varInfo('error', $error); varInfo('size', $size); varInfo('ext', $ext); varInfo('upload err ok', UPLOAD_ERR_OK); if ($error == UPLOAD_ERR_OK) { $valid = true; //validate file extensions if ( $ext !== 'xls' ) { $valid = false; $response = '<span style="color:red">' . $name . ':不是 xls 格式</span><br />'; } //validate file size if ( $size/1024/1024 > 2 ) { $valid = false; $response = '<span style="color:red">' . $name . ':文件不允许超过 2M</span><br />'; } //upload file if ($valid) { if (!file_exists('uploads')) { mkdir('uploads'); } // fixing chinese charset problem in windows $name = iconv('utf-8', 'cp936', $name); $targetPath = dirname( __FILE__ ) . DIRECTORY_SEPARATOR. 'uploads' . DIRECTORY_SEPARATOR. $name; varInfo('tmpName', $tmpName); varInfo('target', $targetPath); varInfo('result', move_uploaded_file($tmpName,$targetPath)); } } else { $response = '<span style="color:red">' . $name . ':上传失败</span><br />'; } echo $error; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>upload keywords files</title> </head> <body> <form enctype="multipart/form-data" action="" method="post"> Select a File:<br /> <input type="file" size="20" name="files[]" multiple /><br /> <input type="submit" name="submit" value="upload" /> </form> </body> </html>
Output for git.master, git.master_jit, rfc.property-hooks
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>upload keywords files</title> </head> <body> <form enctype="multipart/form-data" action="" method="post"> Select a File:<br /> <input type="file" size="20" name="files[]" multiple /><br /> <input type="submit" name="submit" value="upload" /> </form> </body> </html>

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:
58.95 ms | 401 KiB | 8 Q