test
This commit is contained in:
@@ -27,6 +27,15 @@ function getValueByKey($array, $key)
|
||||
|
||||
// Funzione per aggiornare il valore di un certo key in un array di oggetti
|
||||
function updateValueByKey(&$array, $key, $newValue) {
|
||||
foreach ($array as &$item) {
|
||||
if ($item->key === $key) {
|
||||
$item->value = $newValue;
|
||||
break; // Se trova il key, termina il loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateValueByKeyArr(&$array, $key, $newValue) {
|
||||
foreach ($array as &$item) {
|
||||
if ($item['key'] === $key) {
|
||||
$item['value'] = $newValue;
|
||||
|
||||
Reference in New Issue
Block a user