3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fields = array( 'np.title `partner`', 'fm.fmid', 'n.nid', 'ws.sid', 'n.language', ); $extra = array('adgroup', 'campaign', 'content', 'source', 'term', 'mobile', 'tablet'); foreach ($extra as $field) { $fields[] = "{$field}.`value` `{$field}`"; } $extra = array_combine($extra, $extra); $suffix = '_sand'; $sql = 'INSERT INTO {report_generic_report} SELECT ' . implode(', ', $fields) . ", ws.submitted, ps.doi FROM {form_map_history{$suffix}} fmh JOIN {form_map} fm ON fmh.fmid = fm.fmid JOIN {node} np ON fm.vid = np.vid JOIN {webform_submissions{$suffix}} ws ON fmh.sid = ws.sid JOIN {partner_submission{$suffix}} ps ON ws.sid = ps.sid AND fm.vid = ps.vid JOIN {node} n ON ws.nid = n.nid"; foreach ($extra as $field) { $sql .= " LEFT JOIN {webform_submission_extra{$suffix}} `{$field}` ON ws.sid = `{$field}`.sid AND `{$field}`.`name` = '{$field}'"; } $sql .= " WHERE ws.submitted BETWEEN %d AND %d"; if ($form_state['values']['language']) { $sql .= " AND n.`language` = '".$form_state['values']['language']."'"; } $sql .= " ORDER BY `partner`, sid"; print $sql;
based on JWDvl
Output for 5.0.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: form_state in /in/b8u3p on line 22 INSERT INTO {report_generic_report} SELECT np.title `partner`, fm.fmid, n.nid, ws.sid, n.language, adgroup.`value` `adgroup`, campaign.`value` `campaign`, content.`value` `content`, source.`value` `source`, term.`value` `term`, mobile.`value` `mobile`, tablet.`value` `tablet`, ws.submitted, ps.doi FROM {form_map_history_sand} fmh JOIN {form_map} fm ON fmh.fmid = fm.fmid JOIN {node} np ON fm.vid = np.vid JOIN {webform_submissions_sand} ws ON fmh.sid = ws.sid JOIN {partner_submission_sand} ps ON ws.sid = ps.sid AND fm.vid = ps.vid JOIN {node} n ON ws.nid = n.nid LEFT JOIN {webform_submission_extra_sand} `adgroup` ON ws.sid = `adgroup`.sid AND `adgroup`.`name` = 'adgroup' LEFT JOIN {webform_submission_extra_sand} `campaign` ON ws.sid = `campaign`.sid AND `campaign`.`name` = 'campaign' LEFT JOIN {webform_submission_extra_sand} `content` ON ws.sid = `content`.sid AND `content`.`name` = 'content' LEFT JOIN {webform_submission_extra_sand} `source` ON ws.sid = `source`.sid AND `source`.`name` = 'source' LEFT JOIN {webform_submission_extra_sand} `term` ON ws.sid = `term`.sid AND `term`.`name` = 'term' LEFT JOIN {webform_submission_extra_sand} `mobile` ON ws.sid = `mobile`.sid AND `mobile`.`name` = 'mobile' LEFT JOIN {webform_submission_extra_sand} `tablet` ON ws.sid = `tablet`.sid AND `tablet`.`name` = 'tablet' WHERE ws.submitted BETWEEN %d AND %d ORDER BY `partner`, sid
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: form_state in /in/b8u3p on line 22 INSERT INTO {report_generic_report} SELECT np.title `partner`, fm.fmid, n.nid, ws.sid, n.language, adgroup.`value` `adgroup`, campaign.`value` `campaign`, content.`value` `content`, source.`value` `source`, term.`value` `term`, mobile.`value` `mobile`, tablet.`value` `tablet`, ws.submitted, ps.doi FROM {form_map_history_sand} fmh JOIN {form_map} fm ON fmh.fmid = fm.fmid JOIN {node} np ON fm.vid = np.vid JOIN {webform_submissions_sand} ws ON fmh.sid = ws.sid JOIN {partner_submission_sand} ps ON ws.sid = ps.sid AND fm.vid = ps.vid JOIN {node} n ON ws.nid = n.nid LEFT JOIN {webform_submission_extra_sand} `adgroup` ON ws.sid = `adgroup`.sid AND `adgroup`.`name` = 'adgroup' LEFT JOIN {webform_submission_extra_sand} `campaign` ON ws.sid = `campaign`.sid AND `campaign`.`name` = 'campaign' LEFT JOIN {webform_submission_extra_sand} `content` ON ws.sid = `content`.sid AND `content`.`name` = 'content' LEFT JOIN {webform_submission_extra_sand} `source` ON ws.sid = `source`.sid AND `source`.`name` = 'source' LEFT JOIN {webform_submission_extra_sand} `term` ON ws.sid = `term`.sid AND `term`.`name` = 'term' LEFT JOIN {webform_submission_extra_sand} `mobile` ON ws.sid = `mobile`.sid AND `mobile`.`name` = 'mobile' LEFT JOIN {webform_submission_extra_sand} `tablet` ON ws.sid = `tablet`.sid AND `tablet`.`name` = 'tablet' WHERE ws.submitted BETWEEN %d AND %d ORDER BY `partner`, sid
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_combine() in /in/b8u3p on line 15
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_combine() in /in/b8u3p on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_combine() in /in/b8u3p on line 15