The following example lists the layers in a map, along with an indicator of the layer visibility setting.
$layers = $map->GetLayers(); // Get layer collection echo "<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>';