3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ 'foo' => 'FOO', 'bar' => 'BAR', 'baz' => 'BAZ', 'dragons' => 'DRAGONS', ]; var_dump( $array ); (unset) $array['foo']; var_dump( $array ); unset( $array['foo'] ); var_dump( $array );
based on iJtNo
Output for 7.2.0 - 7.3.0alpha1
Deprecated: The (unset) cast is deprecated in /in/CrRJI on line 10 array(4) { ["foo"]=> string(3) "FOO" ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" } array(4) { ["foo"]=> string(3) "FOO" ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" } array(3) { ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" }
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.1.7
array(4) { ["foo"]=> string(3) "FOO" ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" } array(4) { ["foo"]=> string(3) "FOO" ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" } array(3) { ["bar"]=> string(3) "BAR" ["baz"]=> string(3) "BAZ" ["dragons"]=> string(7) "DRAGONS" }