3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(1, 2, 3, 4); $obj = new stdClass(); list( $obj->a, $obj->b, $obj->c, $obj->d ) = $arr; var_dump($obj);
based on bYCcF
Output for 7.0.0 - 7.2.0
object(stdClass)#1 (4) { ["a"]=> int(1) ["b"]=> int(2) ["c"]=> int(3) ["d"]=> int(4) }
Output for 5.3.19 - 5.6.28
object(stdClass)#1 (4) { ["d"]=> int(4) ["c"]=> int(3) ["b"]=> int(2) ["a"]=> int(1) }