I have the following JavaScript array :
[#ad: Array[0]]
#ad: Array[0]
#image_upload: Array[0]
13b7afb8b11644e17569bd2efb571b10: "This is an error"
69553926a7783c27f7c18eff55cbd429: "Yet another error"
d3042d83b81e01d5c2b8bbe507f0d709: "Another error"
Array[0]
#image_url: Array[0]
2b4a9847e26368312704b8849de9247a: "URL error"
This is the array representation in my browser console.
Unfortunatelly I cannot find a way to remove the elements of the $errors['#ad']['#image_upload']
based on the md5
keys.
In example, let's say I like to remove the message "Yet another error"
by using the corresponding md5 key 69553926a7783c27f7c18eff55cbd429
.
I have try the method indexOf
but this is not the correct one, as return the index of the value in the array. What I need is the opposite, I need to remove the value directly by using the index of the value.
How can I perform this task ? Any idea ?
The delete
operator should work here:
delete $errors['#ad']['#image_upload']['69553926a7783c27f7c18eff55cbd429']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With