3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = "http://somedomain/somefolder/someresoure/somemodel/someaction/id"; $apart = explode('/',$url); foreach ($apart as $key => $val) { echo "<p>"; echo 'key: ' . $key . ', value: ' . $val . '.....'; echo "</p>"; } ?>
based on 3Qone
Output for 4.3.0 - 7.1.0
<p>key: 0, value: http:.....</p><p>key: 1, value: .....</p><p>key: 2, value: somedomain.....</p><p>key: 3, value: somefolder.....</p><p>key: 4, value: someresoure.....</p><p>key: 5, value: somemodel.....</p><p>key: 6, value: someaction.....</p><p>key: 7, value: id.....</p>