3v4l.org

run code in 200+ php & hhvm versions
<?php $str = 'abc'; echo $str[TRUE]; // Notice: String offset cast occurred echo $str[NULL]; // Notice: String offset cast occurred echo $str[[]]; // Warning: Illegal offset type $int = 123; echo $int[1]; // no error echo $int[TRUE]; // no error echo $int[[]]; // no error $bool = TRUE; echo $bool[1]; // no error echo $bool[TRUE]; // no error echo $bool[[]]; // no error
based on vMvD2
Output for 5.6.0 - 7.3.1
Notice: String offset cast occurred in /in/JCXR1 on line 5 b Notice: String offset cast occurred in /in/JCXR1 on line 6 a Warning: Illegal offset type in /in/JCXR1 on line 7 a