3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <categories> <category>Landscape</category> <category>Wildlife</category> <category>Action/Sports</category> <category>Portrait</category> <category>Architectural</category> <category>Wedding</category> <category>Events</category> <category>Fashion</category> <category>Macro</category> <category>Family</category> <category>Baby</category> <category>Abstract</category> <category>Bodyscape</category> <category>Forced Perspective</category> <category>Modeling</category> </categories> XML; $categories = (array)simplexml_load_string($xml, 'SimpleXMLElement')->category; sort($categories); foreach ($categories as $category) { echo $category , "\n"; }
Output for 7.1.25 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Abstract Action/Sports Architectural Baby Bodyscape Events Family Fashion Forced Perspective Landscape Macro Modeling Portrait Wedding Wildlife

preferences:
171.13 ms | 403 KiB | 175 Q