str_replace or preg_replace random number from string
PHP Snippet 1:
$id = $_GET["id"]
PHP Snippet 2:
$url = "http://anyurl/index.php?id=".$id."&abc=any"
PHP Snippet 3:
<?php
$string = 'http://anyurl/index.php?id=4876&abc=any';
$new_string = preg_replace('/[0-9]+/', $_GET["id"], $string);
echo $new_string;
// Will display http://anyurl/index.php?id=3345&abc=any
?>