I have an array that is assigned to $elements. When I use array_keys to get the keys, I get what you would expect.
print_r(array_keys($elements));
Results in:
Array
(
[0] => anchor-namecontentblock_areaBlock0contentblock11_1
[1] => anchor-namecontentblock_areaBlock0contentblock22_1
[2] => anchor-namecontentblock_areaBlock0contentblock33_1
...
But when I try to use array_keys with a search value, I get an empty array.
print_r(array_keys($elements, "anchor-namecontentblock_areaBlock0contentblock11_1"));
Should the result not be:
Array
(
[0] => 0
)
Am I missing something?
$elements?array_search()array_keys($elements)not the original array.array_search()is to search for values, not keys.XDebugset up too.Searches the array for a given value and returns the corresponding key if successfulSo OP wants to find the key from the value