array_replace

It replaces elements from passed arrays into the first array

Example

<?php
echo “<pre>”;
$array1 = array(‘WEB’ => array( “PHP”) , ‘ASP’ => array(“JAVA”, “JSP”), );
$array2 = array(‘JScript’ => array(‘VB’), ‘JS’ => array(‘C’));

$array2 = array_replace($array1, $array2);
print_r($array2);
?>

Output

Array
(
[WEB] => Array
(
[0] => PHP
)

[ASP] => Array
(
[0] => JAVA
[1] => JSP
)

[JScript] => Array
(
[0] => VB
)

[JS] => Array
(
[0] => C
)

)

Share