mirror of
https://github.com/sigmasternchen/useful-api.org
synced 2025-03-15 16:08:55 +00:00
10 lines
250 B
PHP
10 lines
250 B
PHP
<?php
|
|
|
|
function &array_get_or_add($needle, array &$haystack, $default=null) {
|
|
if (key_exists($needle, $haystack)) {
|
|
return $haystack[$needle];
|
|
} else {
|
|
$haystack[$needle] = $default;
|
|
return $haystack[$needle];
|
|
}
|
|
}
|