3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(); $v = 'before'; $arr[][$v = 'after'] = $v; $v = 'before'; $arr[][$v] = $v = 'after'; $v = 'before'; $arr[][$v . ''] = $v = 'after'; var_export($arr);
based on 4dtR4
Output for 5.1.0 - 5.6.30, hhvm-3.10.1 - 3.22.0, 7.0.0 - 7.2.6
array ( 0 => array ( 'after' => 'after', ), 1 => array ( 'after' => 'after', ), 2 => array ( 'before' => 'after', ), )
Output for 4.3.0 - 5.0.5
array ( 0 => array ( 'after' => 'after', ), 1 => array ( 'before' => 'after', ), 2 => array ( 'before' => 'after', ), )