3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/html; charset=utf-8"); if (isset($_POST['submit'])) { $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)); 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; } } else { $response = '<span style="color:red">' . $name . ':upload failed</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:
59.76 ms | 401 KiB | 8 Q