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 e05hi
Output for 7.1.0
string(5) "hello"
Output for 4.3.0 - 7.0.14
array(5) { [0]=> string(1) "h" [1]=> string(1) "e" [2]=> string(1) "l" [3]=> string(1) "l" [4]=> string(1) "o" }