3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //php AjaxHelper::add_action('resume_download', function () { AjaxHelper::verify_nonce(); $resumes_string = isset($_POST['resumes']) ? trim($_POST['resumes']) : ''; $resumes = explode(',', $resumes_string); $files = []; if (count($resumes) > 0) { foreach ($resumes as $resume) { $resume_file_id = get_post_meta( $resume, 'resume_file', true ); if (!empty($resume_file_id)) { $files[] = get_attached_file($resume_file_id); } } } header('Pragma: public'); header('Accept-Ranges: bytes'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Disposition: attachment; filename="archive.zip"'); header('Content-Type: application/octet-stream'); $fp = popen('zip -j -q -r - ' . implode(' ', array_map('escapeshellarg', $files)), 'r'); $bufsize = 8192; $buff = ''; while (!feof($fp)) { echo fread($fp, $bufsize); } pclose($fp); exit(); }); //html <form id="download_form" method="post" action="<?= admin_url('admin-ajax.php') ?>" class="selected-action"> <input type="hidden" name="<?= THEME_NONCE_NAME ?>" value="<?= wp_create_nonce(THEME_NONCE_ACTION) ?>"> <input type="hidden" name="action" value="resume_download" /> <input type="hidden" name="resumes" value="" /> <button class="downloads"><?php _e('Download my selection of CV', 'hec'); ?></button> </form> //js $(".downloads").click(function () { var resumes = [], table = $('table > tbody > tr'); table.each(function () { var resume_id = $(this).attr('data-id'); if ($(this).hasClass('selected')) { resumes.push(resume_id); } }); var string_resumes = resumes.toString(); $("input[name='resumes']").val(string_resumes); $('#download_form').submit(); });
based on NkHXf
Output for 7.0.0 - 7.1.7
Parse error: syntax error, unexpected '<', expecting end of file in /in/pDYfT on line 42
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected '<', expecting $end in /in/pDYfT:42 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '<' in /in/pDYfT on line 42
Process exited with code 255.