3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function hilightTerms($search_term, $content, $class="hilight") { $search_term = str_replace('\p','p',$search_term); $get_words = preg_split("/\s+/", $search_term); $words = array_unique($get_words); $stopWords = array('and', 'or'); foreach ($words as $word) { if (in_array(strtolower($word), $stopWords)) continue; $word = preg_quote($word); if (empty($word)) continue; $content = preg_replace("/$word/i", "<span class=\"$class\">$word</span>", $content); } return $content; } $q = "(.*)/e\0"; $body = '$secret=0x1337'; var_dump($secret); hilightTerms($q, $body); var_dump($secret);
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/s2lgn on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_PUBLIC in /in/s2lgn on line 3
Process exited with code 255.

preferences:
182.46 ms | 1395 KiB | 56 Q