3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ #ints 0,1,2,-1,-2, #floats 0.0,0.1,0.2,1.0,1.1,2.0,2.1, -0.1,-0.2,-1.0,-1.1,-2.0,-2.1, #strings "", "a", "0","@","NULL", #bool true, false, #array [], ["a"],[[]], #object new stdClass, #null NULL,"\0", function(){}, ]; foreach($test as $k => $v){ if(is_scalar($v)){ $j = $k + 97; ${$j} = new stdClass; ${$j}->${$j} = $v; $test[] = ${$j}; } } print_r($test);

preferences:
43.57 ms | 402 KiB | 5 Q