One interesting way is by using array_keys() array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys()array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys()array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys withfor a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys with a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).
One interesting way is by using array_keys():
foreach (array_keys($messages, 401, true) as $key) {
unset($messages[$key]);
}
The array_keys() function takes two additional parameters to return only keys for a particular value and whether strict checking is required (i.e. using === for comparison).
This can also remove multiple array items with the same value (e.g. [1, 2, 3, 3, 4]).