3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Hello world; This is a nice day; after"; $str = explode(";",$string); $size=sizeof($str); $newstr = array(); $newstr[0] = $str[$size-1]; $newstr[1] = "--".substr($string, 0, strrpos($string, ";"))."--"; print_r($newstr);

preferences:
32.96 ms | 402 KiB | 5 Q