We are spoilt for choice when to use the urlencode() and the raw_urlencode() as we won't be always dealing with one same url. For example, we might be outputting on page different urls from our mysql db or outputting on page different urls that the user just submitted on our webform.
In short, we don't know what the value of $url will be.
For our learning purpose, is there any chance you can write two lines of code (a custom function) that checks the $url value to see whether it has string chars that are best to use urlencode() over the raw_url_encode() or best to use raw_url_encode() over the url_encode() ? And then our custom function can use the appropriate function out of the two built-in functions . That way, we don't use' the wrong function, out of the two, unnecessarily.
Have you ever tried building something like this, ever ?
Anyone else welcome to give this custom function building a go. I'm still at beginner level and so this is a bit over my head.