note 124705 added to function.array-replace-recursive

From: Date: Mon, 10 Feb 2020 17:14:11 +0000
Subject: note 124705 added to function.array-replace-recursive
Groups: php.notes 
Request: Send a blank email to php-notes+get-214078@lists.php.net to get a copy of this message
Note that function will NOT replace a sub-tree from you $array1 if its value in $array2 is an empty array. Even tho the key for this dimension is technically 'set'. (I suppose it treats it as just another recursive level to dive in, finding no key to compare, backtracking while leaving this sub-tree alone) For example: $array1 = ['first' => ['second' => 'hello']]; $array2 = ['first' => []]; $result = array_replace_recursive($array1, $array2); $result is still: ['first' => ['second' => 'hello']]. ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.166.36 (proxied: 62.14.229.40) ---- Manual Page -- http://php.net/manual/en/function.array-replace-recursive.php Edit -- https://master.php.net/note/edit/124705 Del: integrated -- https://master.php.net/note/delete/124705/integrated Del: useless -- https://master.php.net/note/delete/124705/useless Del: bad code -- https://master.php.net/note/delete/124705/bad+code Del: spam -- https://master.php.net/note/delete/124705/spam Del: non-english -- https://master.php.net/note/delete/124705/non-english Del: in docs -- https://master.php.net/note/delete/124705/in+docs Del: other reasons-- https://master.php.net/note/delete/124705 Reject -- https://master.php.net/note/reject/124705 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214078) next »