- substr: documentation ( source)
- explode: documentation ( source)
- strrpos: documentation ( source)
<?php
$string = "Hello world; This is a nice day; after";
$str = explode(";",$string);
$size=sizeof($str);
$newstr = $str[$size]." ".substr($string, 0, strrpos($string, ";"));