3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $options = array('data_class' => 'foobar', 'required' => true, 'attr' => array('class' => 'custom', 'placeholder' => 'custom bar')); $typeGuessOptions = array('data_class' => 'foo', 'multiple' => true, 'attr' => array('placeholder' => 'bar', 'maxlength' => 10)); var_dump( array_replace_recursive($typeGuessOptions, $options) );
based on ouB1d
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
array(4) { ["data_class"]=> string(6) "foobar" ["multiple"]=> bool(true) ["attr"]=> array(3) { ["placeholder"]=> string(10) "custom bar" ["maxlength"]=> int(10) ["class"]=> string(6) "custom" } ["required"]=> bool(true) }