One practical reason to choose one over the other is if you're going to use the result in another environment, for example JavaScript.
In PHP urlencode('test 1')
returns 'test+1'
while rawurlencode('test 1')
returns 'test%201'
as result.
But if you need to "decode" this in JavaScript using decodeURI() function then decodeURI("test+1")
will give you "test+1"
while decodeURI("test%201")
will give you "test 1"
as result.
In other words the space (" ") encoded by urlencode to plus ("+") in PHP will not be properly decoded by decodeURI in JavaScript.
In such cases the rawurlencode PHP function should be used.