run code in 200+ php & hhvm versions
Bugs & Features
<?php $query = "Google"; $elasticaResult = array("content"=>"Google Account, you need to have JavaScript enabled in your browser. Refresh this page after you have enabled JavaScript. Create a new Google Account Name First name First Last name Last"); $queryReplace = "<span class=\"found\">".$query."</span>"; $descriptionContent = $elasticaResult->content; $foundQuery = stristr($descriptionContent, $query); $queryInDescription = str_replace($query, $queryReplace, $foundQuery); echo $queryInDescription;
Output for 5.0.0 - 7.1.7
Notice: Trying to get property of non-object in /in/GGgjU on line 5
Output for 4.3.0 - 4.4.9