Upgrade to 4.1.0

This commit is contained in:
Bastian Allgeier
2024-01-30 16:41:06 +01:00
parent 5c44c8fcfd
commit 9345fc1a0b
59 changed files with 678 additions and 274 deletions

View File

@@ -351,6 +351,31 @@ class A
return in_array($value, $array, $strict);
}
/**
* Join array elements as a string,
* also supporting nested arrays
*/
public static function implode(
array $array,
string $separator = ''
): string {
$result = '';
foreach ($array as $value) {
if (empty($result) === false) {
$result .= $separator;
}
if (is_array($value) === true) {
$value = static::implode($value, $separator);
}
$result .= $value;
}
return $result;
}
/**
* Checks whether an array is associative or not
*
@@ -914,9 +939,7 @@ class A
*
* // with callback
* A::update($user, [
* 'username' => function ($username) {
* return $username . ' j. simpson'
* }
* 'username' => fn ($username) => $username . ' j. simpson'
* ]);
* </code>
*/