run code in 200+ php & hhvm versions
Bugs & Features
<?php $drinks = array("maza","coffe","coffe","coffe"); $foods = array("coffe","choco","choco","choco","appy","kurkure","maggi"); $temp=0; foreach($drinks as $drink){ //you could use foreach instead of for foreach($foods as $food){ if($drink==$food){ $temp++; } //always use brakets } echo "word count of".$drink.' is '.$temp; echo "<br/>"; } //br looks like this
Output for 4.3.0 - 5.0.5, 5.1.1 - 7.2.0
word count ofmaza is 0<br/>word count ofcoffe is 1<br/>word count ofcoffe is 2<br/>word count ofcoffe is 3<br/>
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/oQcA6 on line 20
Process exited with code 255.