3v4l.org

run code in 200+ PHP versions simultaneously
<?php $_SESSION ['test'] [ 't****' ] = 'Hello'; var_dump($_SESSION); echo "\n" . $_SESSION [ 'test' ] [ 't****' ]; $var = "test2"; for ($i = 4 ; $i > 0 ; $i--){ $var [$i] = "*"; echo "\n" . $_SESSION['test'][$var]; }
based on U0bjE
Output for 5.3.0 - 5.6.30, 7.0.11 - 7.2.6
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/YANSb on line 12 Notice: Undefined index: tes** in /in/YANSb on line 12 Notice: Undefined index: te*** in /in/YANSb on line 12 Hello
Output for 7.0.0 - 7.0.10
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/YANSb on line 12 Notice: Undefined index: tes** in /in/YANSb on line 12 Notice: Undefined index: te*** in /in/YANSb on line 12 Notice: Undefined index: t**** in /in/YANSb on line 12
Output for 4.3.0 - 5.2.17
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/YANSb on line 12 Notice: Undefined index: tes** in /in/YANSb on line 12 Notice: Undefined index: te*** in /in/YANSb on line 12 Hello