3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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]; } $var = "test2"; for ($i = 0 ; $i < 4 ; $i++){ $var = substr($var, count($var)-1, -$i) . '*'; echo "\n" . $_SESSION['test'][$var]; }
based on lAOV6
Output for 7.2.0 - 7.3.0beta1
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/A5AID on line 12 Notice: Undefined index: tes** in /in/A5AID on line 12 Notice: Undefined index: te*** in /in/A5AID on line 12 Hello Warning: count(): Parameter must be an array or an object that implements Countable in /in/A5AID on line 18 Notice: Undefined index: * in /in/A5AID on line 19 Warning: count(): Parameter must be an array or an object that implements Countable in /in/A5AID on line 18 Notice: Undefined index: * in /in/A5AID on line 19 Warning: count(): Parameter must be an array or an object that implements Countable in /in/A5AID on line 18 Notice: Undefined index: * in /in/A5AID on line 19 Warning: count(): Parameter must be an array or an object that implements Countable in /in/A5AID on line 18 Notice: Undefined index: * in /in/A5AID on line 19
Output for 5.6.0 - 5.6.25, 7.0.20 - 7.1.20
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/A5AID on line 12 Notice: Undefined index: tes** in /in/A5AID on line 12 Notice: Undefined index: te*** in /in/A5AID on line 12 Hello Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19
Output for 7.0.0 - 7.0.10
array(1) { ["test"]=> array(1) { ["t****"]=> string(5) "Hello" } } Hello Notice: Undefined index: test* in /in/A5AID on line 12 Notice: Undefined index: tes** in /in/A5AID on line 12 Notice: Undefined index: te*** in /in/A5AID on line 12 Notice: Undefined index: t**** in /in/A5AID on line 12 Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19 Notice: Undefined index: * in /in/A5AID on line 19