3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = ['foo', 'bar', 'doo', 'lorem', 'ipsum']; // Take the current array-key from the URL $key = 3; // $_GET['key'] // validate if it really exists in the array, otherwise take a fallback if(!array_key_exists($key, $items)) $key = 0; // show data to this key echo $items[$key]; // provide a button to switch to the next array key sprintf('<a href="?key=%s">next</a>', $key+1);

preferences:
27.96 ms | 404 KiB | 5 Q