<?php $res_events = "|2,20171021|1,20171007|2,20171007|1,20171028|2,20171014|1,20171014|2,20171028|1,20171021|"; $arr = explode("|", $res_events); Sort($arr); // Remove one of the two empty values in array Unset($arr[0]); // Implode and add last "|" $new =implode("|", $arr)."|"; Echo $new;
You have javascript disabled. You will not be able to edit any code.