3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = 'hello world'; $selectedString = ''; for ($i = 0; $i <= 5; $i++) { $selectedString[$i] = $string[$i]; } var_dump($selectedString);
based on ui0Lp
Output for 7.1.0
string(6) "hello "
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.0.14
array(6) { [0]=> string(1) "h" [1]=> string(1) "e" [2]=> string(1) "l" [3]=> string(1) "l" [4]=> string(1) "o" [5]=> string(1) " " }
Output for hhvm-3.10.0

Process exited with code 153.