I have created an array of values and i'm wondering whether its possible to get the value of the parent item.
For example, if I have the value logo how can I retrieve that it belongs to FREE?
$widget_classes = array(
'FREE' => array(
'logo',
'clock',
'text',
'rss',
'rss marquee',
),
);
array_key_first(array_filter($widget_classes, fn($v) => in_array('logo', $v)))if you absolutely want a oneliner (PHP 7.3+). But seriously, use @u_mulder's solution (put it in a proper function/method), it's easier to read, and also more efficient as it will shortcircuit as soon as it finds the right key.