3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $types = array('string', 1, '1', '', '0', 0, 0.0, array(), new StdClass, true, false, null); foreach ($types as $type) { var_dump((array) $type); }
based on t1Rup
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(1) { [0]=> string(6) "string" } array(1) { [0]=> int(1) } array(1) { [0]=> string(1) "1" } array(1) { [0]=> string(0) "" } array(1) { [0]=> string(1) "0" } array(1) { [0]=> int(0) } array(1) { [0]=> float(0) } array(0) { } array(0) { } array(1) { [0]=> bool(true) } array(1) { [0]=> bool(false) } array(0) { }