[Fusionforge-commits] r9475 - trunk/gforge/common/include
Roland Mas
lolando at libremir.placard.fr.eu.org
Wed Apr 14 16:14:01 CEST 2010
Author: lolando
Date: 2010-04-14 16:14:00 +0200 (Wed, 14 Apr 2010)
New Revision: 9475
Modified:
trunk/gforge/common/include/utils.php
Log:
Implemented array_replace_recursive() for users of PHP?\194?\160< 5.3
Modified: trunk/gforge/common/include/utils.php
===================================================================
--- trunk/gforge/common/include/utils.php 2010-04-14 13:11:55 UTC (rev 9474)
+++ trunk/gforge/common/include/utils.php 2010-04-14 14:14:00 UTC (rev 9475)
@@ -1149,6 +1149,29 @@
return true;
}
+// array_replace_recursive only appeared in PHP 5.3.0
+if (!function_exists('array_replace_recursive')) {
+ function array_replace_recursive ($a1, $a2) {
+ $result = $a1 ;
+
+ if (!is_array ($a2)) {
+ return $a2 ;
+ }
+
+ foreach ($a2 as $k => $v) {
+ if (!is_array ($v) ||
+ !isset ($result[$k]) || !is_array ($result[$k])) {
+ $result[$k] = $v ;
+ }
+
+ $result[$k] = array_replace_recursive ($result[$k],
+ $v) ;
+ }
+
+ return $result ;
+ }
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
More information about the Fusionforge-commits
mailing list