3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // fr: http://stackoverflow.com/questions/3232061/booltrue-var-does-not-get-converted-to-array-on-array-assignment-but-boolfa $myVar = false; $myVar[] = 'Hello'; // Converted into an array var_dump($myVar); $myVar = true; $myVar[] = 'Hello'; // Converted into an array var_dump($myVar);
Output for 5.2.3 - 7.1.0
array(1) { [0]=> string(5) "Hello" } Warning: Cannot use a scalar value as an array in /in/tRhRc on line 7 bool(true)
Output for 4.3.0 - 5.2.2
array(1) { [0]=> string(5) "Hello" } <br /> <b>Warning</b>: Cannot use a scalar value as an array in <b>/in/tRhRc</b> on line <b>7</b><br /> bool(true)