How can you access specific data within nested arrays in PHP, such as points within polygons?

To access specific data within nested arrays in PHP, such as points within polygons, you can use nested loops to iterate through the arrays and access the desired data at each level. For example, if you have an array of polygons where each polygon is represented by an array of points, you can use nested loops to access each point within each polygon.

$polygons = [
    [[1, 2], [3, 4], [5, 6]],
    [[7, 8], [9, 10], [11, 12]]
];

foreach ($polygons as $polygon) {
    foreach ($polygon as $point) {
        echo "Point: ($point[0], $point[1])\n";
    }
}