3v4l.org

run code in 300+ PHP versions simultaneously
<?php function removeIdFromString(string $str, string$id):string { return str_replace([$id, ',,'], ['',','], $str); } $str = "3,5,7,9"; echo removeIdFromString($str,7);

preferences:
25.9 ms | 404 KiB | 5 Q