3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php public function ajax_autocomplete() { global $wpdb; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'visual_form_builder_autocomplete') { $term = esc_html($_REQUEST['term']); $form_id = absint($_REQUEST['form']); $field_id = absint($_REQUEST['field']); if ($field_id == 1426) { $fields = $wpdb->get_results("SELECT `subject` FROM $this->field_table_name"); $suggestions = array(); foreach($fields as $field) { $pos = stripos((string)$field->subject, $term); // // If a match was found, add it to the suggestions if ($pos !== false) $suggestions[] = array( 'value' => (string)$field->subject ); } } else { $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->field_table_name WHERE form_id = %d AND field_id = %d ORDER BY field_sequence ASC", $form_id, $field_id)); $suggestions = array(); foreach($fields as $field) { $options = unserialize($field->field_options); foreach($options as $opts) { // Find a match in our list of options $pos = stripos($opts, $term); // If a match was found, add it to the suggestions if ($pos !== false) $suggestions[] = array( 'value' => $opts ); } } } // Send a JSON-encoded array to our AJAX call echo json_encode($suggestions); } die(1); }
Output for 5.4.0 - 5.4.31
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/TlLpm on line 2
Process exited with code 255.
Output for 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC in /in/TlLpm on line 2
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PUBLIC in /in/TlLpm on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_FUNCTION in /in/TlLpm on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_FUNCTION in /in/TlLpm on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/TlLpm on line 2
Process exited with code 255.