<?php
$array = array (
91 =>
array (
'description' => 'Charged',
'boundingPoly' =>
array (
'vertices' =>
array (
0 =>
array (
'x' => 244,
'y' => 438
),
1 =>
array (
'x' => 287,
'y' => 438
),
2 =>
array (
'x' => 287,
'y' => 452
),
3 =>
array (
'x' => 244,
'y' => 452
),
')))'
)
)
)
);
$x = 244;
foreach ($array as $box) {
if (in_array($x, array_column($box['boundingPoly']['vertices'], 'x'))) {
$descr = $box['description'];
break;
}
}
if (isset($descr)) {
echo "found $descr with x = $x\n";
}
preferences:
26.5 ms | 405 KiB | 5 Q