Skip to content
Advertisement

array_search function for JSON File in PHP

File:

JavaScript

I want an array of it so i do:

JavaScript

And then i want to enter a value and this value should identify the entry from the Array and delete the whole entry:

JavaScript

I entered the value: 10 so the first entry of the array should be deleted.

I think array_search cant read my $json but i dont know why. Can smb fix this ?

Advertisement

Answer

You also need to specify the key you are searching (‘Preis’). array_column() will help us:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement