Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04b47574eb | ||
|
|
ecc52e2dbd |
@@ -105,6 +105,7 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* set the language encoding and language settings
|
* set the language encoding and language settings
|
||||||
|
* use $OVERRIDE_LANG to override all language settings
|
||||||
* the default charset from _SESSION login or from
|
* the default charset from _SESSION login or from
|
||||||
* config DEFAULT ENCODING
|
* config DEFAULT ENCODING
|
||||||
* the lang full name for mo loading from _SESSION login
|
* the lang full name for mo loading from _SESSION login
|
||||||
|
|||||||
@@ -1236,12 +1236,22 @@ class Basic
|
|||||||
$path[] = $key_lookin;
|
$path[] = $key_lookin;
|
||||||
} else {
|
} else {
|
||||||
foreach ($haystack as $key => $val) {
|
foreach ($haystack as $key => $val) {
|
||||||
if (is_scalar($val) && $val === $needle && empty($key_lookin)) {
|
if (is_scalar($val) &&
|
||||||
break;
|
$val === $needle &&
|
||||||
} elseif (is_scalar($val) && !empty($key_lookin) && $key === $key_lookin && $val == $needle) {
|
empty($key_lookin)
|
||||||
|
) {
|
||||||
$path[] = $key;
|
$path[] = $key;
|
||||||
break;
|
break;
|
||||||
} elseif (is_array($val) && $path = Basic::arraySearchRecursive($needle, $val, $key_lookin)) {
|
} elseif (is_scalar($val) &&
|
||||||
|
!empty($key_lookin) &&
|
||||||
|
$key === $key_lookin &&
|
||||||
|
$val == $needle
|
||||||
|
) {
|
||||||
|
$path[] = $key;
|
||||||
|
break;
|
||||||
|
} elseif (is_array($val) &&
|
||||||
|
$path = Basic::arraySearchRecursive($needle, $val, $key_lookin)
|
||||||
|
) {
|
||||||
array_unshift($path, $key);
|
array_unshift($path, $key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1380,6 +1390,21 @@ class Basic
|
|||||||
return $merged;
|
return $merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* correct array_diff that does an actualy difference between two arrays.
|
||||||
|
* array_diff only checks elements from A that are not in B, but not the
|
||||||
|
* other way around.
|
||||||
|
* Note that like array_diff this only checks first level values not keys
|
||||||
|
* @param array $a array to compare a
|
||||||
|
* @param array $b array to compare b
|
||||||
|
* @return array array with missing elements from a & b
|
||||||
|
*/
|
||||||
|
public static function arrayDiff(array $a, array $b): array
|
||||||
|
{
|
||||||
|
$intersect = array_intersect($a, $b);
|
||||||
|
return array_merge(array_diff($a, $intersect), array_diff($b, $intersect));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* search for the needle array elements in haystack and return the ones found as an array,
|
* search for the needle array elements in haystack and return the ones found as an array,
|
||||||
* is there nothing found, it returns FALSE (boolean)
|
* is there nothing found, it returns FALSE (boolean)
|
||||||
|
|||||||
Reference in New Issue
Block a user