This commit is contained in:
paoloar77
2024-05-19 13:11:57 +02:00
parent 23c08749a0
commit e83b7d213e
2 changed files with 10 additions and 3 deletions

View File

@@ -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;