- array_search: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
<?php
$oldpost = "345,346,347";
$posts = explode(",",$oldpost);
$index = array_search(346,$posts);
if($index !== false){
unset($posts[$index]);
}
$new_post = implode(",",$posts);
echo $new_post;