3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $src = array('foo : bar', 'foo...bar'); $i = 0; while ($src[$i]) { $words += count($src[$i]); $i++; } echo "Lines: $i - Words: $words";
Output for 7.2.0 - 7.3.0rc4
Warning: count(): Parameter must be an array or an object that implements Countable in /in/sPXsI on line 5 Notice: Undefined variable: words in /in/sPXsI on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/sPXsI on line 5 Notice: Undefined offset: 2 in /in/sPXsI on line 4 Lines: 2 - Words: 2
Output for 5.3.0 - 7.1.20
Notice: Undefined variable: words in /in/sPXsI on line 5 Notice: Undefined offset: 2 in /in/sPXsI on line 4 Lines: 2 - Words: 2
Output for 5.0.4 - 5.2.17
Notice: Undefined variable: words in /in/sPXsI on line 5 Notice: Undefined offset: 2 in /in/sPXsI on line 4 Lines: 2 - Words: 2
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: words in /in/sPXsI on line 5 Notice: Undefined offset: 2 in /in/sPXsI on line 4 Lines: 2 - Words: 2