3v4l.org

run code in 300+ PHP versions simultaneously
<?php $the_mysql_result = array(); $the_mysql_result[0]['id'] = "1"; $the_mysql_result[0]['address']="www.example.com/page1"; $the_mysql_result[0]['title']="Page 1"; $the_mysql_result[0]['content']="The quick dog jumps over the lazy dog."; $the_mysql_result[1]['id'] = "2"; $the_mysql_result[1]['address']="www.example.com/page2"; $the_mysql_result[1]['title']="Page 2"; $the_mysql_result[1]['content']="The best thing about morning is breakfast."; $the_mysql_result[2]['id'] = "3"; $the_mysql_result[2]['address']="www.example.com/page3"; $the_mysql_result[2]['title']="Page 3"; $the_mysql_result[2]['content']="Hotdogs are great ballpark food."; $query="dog"; foreach($the_mysql_result as $results) { $content = $results['content']; $row_occurences = explode($query,$content); foreach($row_occurences as $an_occurence) { $content=$an_occurence.$query; echo '<li class="media"> <a class="pull-left" href="'.$results['address'].'"> <img class="media-object thumbnail" src="'.$results['image'].'" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="'.$results['address'].'">'.$results['title'].'</a></h4> <p>...'.str_replace($query,'<strong>'.$query.'</strong>', substr($content,strpos($content,$query)-25,160)).'...</p> </div> </li>'; $total++; } }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page1"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page1">Page 1</a></h4> <p>...The quick <strong>dog</strong>...</p> </div> </li> Warning: Undefined variable $total in /in/tXhOv on line 43 Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page1"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page1">Page 1</a></h4> <p>... <strong>dog</strong>...</p> </div> </li> Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page1"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page1">Page 1</a></h4> <p>....<strong>dog</strong>...</p> </div> </li> Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page2"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page2">Page 2</a></h4> <p>...out morning is breakfast.<strong>dog</strong>...</p> </div> </li> Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page3"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page3">Page 3</a></h4> <p>...Hot<strong>dog</strong>...</p> </div> </li> Warning: Undefined array key "image" in /in/tXhOv on line 36 <li class="media"> <a class="pull-left" href="www.example.com/page3"> <img class="media-object thumbnail" src="" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="www.example.com/page3">Page 3</a></h4> <p>... are great ballpark food.<strong>dog</strong>...</p> </div> </li>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.91 ms | 409 KiB | 8 Q