Difference between rawurlencode and urlencode in PHP

If we are using get function to retrieve the name and id of our pages in php and if a situation presents itself with a special alphanumeric character after the name,then the browser omits the special character if we don’t encode it.So if it were necessary for us to retrieve the name as it is we use URLENCODE .
consider a sample code  for generating a url <a href=”secondpage.php?name=gautam&id=42″>secondge</a>
RAWURLENCODE and URLENCODE  basically do the same function they convert the special characters.but if we were to write a dynamic webpage then we should use RAWURLENCODE before ‘?’ mark and URLENCODE after that mark.
A SAMPLE CODE—-
<?php
$string= ” gautam kumar “;
echo urlencode($string);
echo “<br/>”;
echo rawurlencode($string);
?>
THE o/p of this code would be
cool + good
cool %20 good