{"id":3182,"date":"2012-05-07T10:45:32","date_gmt":"2012-05-07T10:45:32","guid":{"rendered":"http:\/\/phpcodez.com\/?p=3182"},"modified":"2012-05-07T10:45:32","modified_gmt":"2012-05-07T10:45:32","slug":"array_replace","status":"publish","type":"post","link":"http:\/\/phpcodez.com\/array_replace\/","title":{"rendered":"array_replace"},"content":{"rendered":"<div>It replaces elements from passed arrays into the first array<\/p>\n<p><strong>Example<\/strong><\/p>\n<p>&lt;?php<br \/>\necho &#8220;&lt;pre&gt;&#8221;;<br \/>\n$array1 = array(&#8216;WEB&#8217; =&gt; array( &#8220;PHP&#8221;) , &#8216;ASP&#8217; =&gt; array(&#8220;JAVA&#8221;, &#8220;JSP&#8221;), );<br \/>\n$array2 = array(&#8216;JScript&#8217; =&gt; array(&#8216;VB&#8217;), &#8216;JS&#8217; =&gt; array(&#8216;C&#8217;));<\/p>\n<p>$array2 = array_replace($array1, $array2);<br \/>\nprint_r($array2);<br \/>\n?&gt;<\/p>\n<p><strong>Output<\/strong><\/p>\n<p>Array<br \/>\n(<br \/>\n[WEB] =&gt; Array<br \/>\n(<br \/>\n[0] =&gt; PHP<br \/>\n)<\/p>\n<p>[ASP] =&gt; Array<br \/>\n(<br \/>\n[0] =&gt; JAVA<br \/>\n[1] =&gt; JSP<br \/>\n)<\/p>\n<p>[JScript] =&gt; Array<br \/>\n(<br \/>\n[0] =&gt; VB<br \/>\n)<\/p>\n<p>[JS] =&gt; Array<br \/>\n(<br \/>\n[0] =&gt; C<br \/>\n)<\/p>\n<p>)<br \/>\n<strong id=\"internal-source-marker_0.4157474609091878\"><br \/>\n<\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>It replaces elements from passed arrays into the first array Example &lt;?php echo &#8220;&lt;pre&gt;&#8221;; $array1 = array(&#8216;WEB&#8217; =&gt; array( &#8220;PHP&#8221;) , &#8216;ASP&#8217; =&gt; array(&#8220;JAVA&#8221;, &#8220;JSP&#8221;), ); $array2 = array(&#8216;JScript&#8217; =&gt; array(&#8216;VB&#8217;), &#8216;JS&#8217; =&gt; array(&#8216;C&#8217;)); $array2 = array_replace($array1, $array2); print_r($array2); ?&gt; Output Array ( [WEB] =&gt; Array ( [0] =&gt; PHP ) [ASP] =&gt; Array ( &hellip; <a href=\"http:\/\/phpcodez.com\/array_replace\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">array_replace<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[54,213,370],"class_list":["post-3182","post","type-post","status-publish","format-standard","hentry","category-php","tag-array","tag-functions","tag-php"],"_links":{"self":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/3182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/comments?post=3182"}],"version-history":[{"count":0,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/3182\/revisions"}],"wp:attachment":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/media?parent=3182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/categories?post=3182"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/tags?post=3182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}