3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
55.6 ms | 402 KiB | 5 Q