3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $source_packages = array( 'one' => array ('param1' => 'First Parameter for One', 'param2' => 'Second Parameter for One'), 'two' => array ('param1' => 'First Parameter for Two', 'param2' => 'Second Parameter for Two') ); $packages_from = $source_packages; var_dump($packages_from); echo "<br />\n"; $package_key = 'two'; var_dump($package_key); echo "<br />\n"; $package_value = $source_packages[$package_key]; var_dump($package_value); echo "<br />\n"; $packages_to = array($package_key => $package_value); var_dump($packages_to); echo "<br />\n"; $result_packages = array_diff_assoc($packages_from, $packages_to); var_dump($result_packages); echo "<br />\n"; ?>
Output for 5.4.0 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
array(2) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> string(3) "two" <br /> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } <br /> array(1) { ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> Notice: Array to string conversion in /in/VDEug on line 14 Notice: Array to string conversion in /in/VDEug on line 14 array(1) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } } <br />
Output for hhvm-3.12.0
array(2) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> string(3) "two" <br /> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } <br /> array(1) { ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> Notice: Array to string conversion in /in/VDEug on line -1 Notice: Array to string conversion in /in/VDEug on line -1 array(1) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } } <br />
Output for 4.3.0 - 5.3.29
array(2) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> string(3) "two" <br /> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } <br /> array(1) { ["two"]=> array(2) { ["param1"]=> string(23) "First Parameter for Two" ["param2"]=> string(24) "Second Parameter for Two" } } <br /> array(1) { ["one"]=> array(2) { ["param1"]=> string(23) "First Parameter for One" ["param2"]=> string(24) "Second Parameter for One" } } <br />