3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function removeWhiteSpace($value) { for($i=0;$i<=count($value);$i++) { //$value[$i]=trim($value[$i]); $temp=trim($value[$i]); echo 'length: ' . strlen($value[$i]) . ' = ' . $value[$i] . '<br/>'; } //return $value; } removeWhiteSpace(array("donkey ","cat"));
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
length: 7 = donkey <br/>length: 3 = cat<br/> Notice: Undefined offset: 2 in /in/aGTD3 on line 6 Notice: Undefined offset: 2 in /in/aGTD3 on line 7 Notice: Undefined offset: 2 in /in/aGTD3 on line 7 length: 0 = <br/>
Output for hhvm-3.12.0
length: 7 = donkey <br/>length: 3 = cat<br/> Notice: Undefined index: 2 in /in/aGTD3 on line 6 Warning: trim() expects parameter 1 to be string, null given in /in/aGTD3 on line 6 Notice: Undefined index: 2 in /in/aGTD3 on line 7 Notice: Undefined index: 2 in /in/aGTD3 on line 7 length: 0 = <br/>
Output for hhvm-3.10.0
length: 7 = donkey <br/>length: 3 = cat<br/> Notice: Undefined index: 2 in /in/aGTD3 on line 6 Notice: Undefined index: 2 in /in/aGTD3 on line 7 Notice: Undefined index: 2 in /in/aGTD3 on line 7 length: 0 = <br/>
Output for 4.3.0 - 5.2.17
length: 7 = donkey <br/>length: 3 = cat<br/> Notice: Undefined offset: 2 in /in/aGTD3 on line 6 Notice: Undefined offset: 2 in /in/aGTD3 on line 7 Notice: Undefined offset: 2 in /in/aGTD3 on line 7 length: 0 = <br/>