3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a1 = array('params' => array('width' => 500, 'height' => 200), 'oembed' => true, 'other' => '300'); $a2 = array('params' => array('height' => 100), 'oembed' => false); $expected = array('params' => array('width' => 500, 'height' => 100), 'oembed' => false, 'other' => '300'); var_dump(($expected === array_replace_recursive($a1, $a2))); $a1 = array('params' => array('width' => 500, 'height' => 200), 'oembed' => true, 'other' => '300'); $a2 = array(); $expected = $a1; var_dump(($expected === array_replace_recursive($a1, $a2))); $a1 = array('params' =>array('width' => 500, 'height' => 200), 'oembed' => true, 'other' => '300'); $a2 = array('params' =>array('width' => 100, 'stuff' => 888), 'oembed' => false); $expected = array('params' => array('width' => 100, 'height' => 200, 'stuff' => 888), 'oembed' => false, 'other' => '300'); var_dump(($expected === array_replace_recursive($a1, $a2))); $a1 = array('params' => array('width' => 500, 'height' => 200), 'oembed' => true, 'other' => '300'); $a2 = array('params' => array(), 'oembed' => true); $expected = array('params' => array('width' => 500, 'height' => 200), 'oembed' => true, 'other' => '300'); var_dump(($expected === array_replace_recursive($a1, $a2)));
Output for 5.3.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
bool(true) bool(true) bool(true) bool(true)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.15 - 5.2.17
Fatal error: Call to undefined function array_replace_recursive() in /in/qSsLf on line 5
Process exited with code 255.