I have an multidimensional array like this:
$downloadArray = [
"downloads1" => ["downloadnaam" => "fdgssgsfg"],
"downloads2" => ["downloadnaam" => "eyetyy"],
];
I need to check if the value eyetyy exists in this array under the key downloadnaam
Then I need to find the index of this value and remove it from the array.
The expected result:
$downloadArray = [
"downloads1" => ["downloadnaam" => "fdgssgsfg"]
];
I tried this:
$index = array_search($download->name, array_column($downloadArray, 'downloadnaam'));
if ($index !== null)
{
unset($downloadArray[$index]);
die("found index: " . $index);
}
$download->name contains 'eyetyy'
$downloadArray is my array
But it always dies and doesn’t show any index on screen.
Can anyone help me?