The following example lists the layers in a map, along with an indicator of the layer visibility setting.
$layers = $map->GetLayers(); // Get
layer collectionecho "<p>Layers:<br />";$count = $layers->GetCount();
for ($i = 0; $i < $count; $i++)
{$layer = $layers->GetItem($i);
echo $layer->GetName() . ' (' . ($layer->GetVisible() ? 'on' : 'off') . ')<br />';
}
echo '</p>';