title: urlencode/rawurlencode and automatic decoding
body: <p>Among other differences, <code>urlencode</code> and <code>rawurlencode</code> encode spaces differently. <code>+</code> and <code>%20</code> resepctively. According to the PHP docs, variables are decoded automatically. How does PHP “know” which way to decode it?</p>
  
  <p>I used to use <code>urlencode</code> until I read here on SO that the raw counterpart is generally better. I must say, I've never run into any decoding problems but am curious as to how it works and if you think there are any scenarios when <code>rawurlencode</code> would cause issues due to the automatic decoding.</p>
  
  <p>Thanks.</p>