title: Substituting whitespaces with %20 in PHP. urlencode and rawurlencode does not work
body: <p>I'm trying to constitute a URL from a multi-word string:
  so I have</p>
  
  <pre><code>$str = "my string"
  </code></pre>
  
  <p>and I 'm trying to get :</p>
  
  <pre><code>"http mysite.com/search/my%20string"
  </code></pre>
  
  <p>but I could not do it with PHP.</p>
  
  <pre><code>urlencode($str) =&gt; "my+string"
  rawurlencode($str)=&gt;"my string"
  </code></pre>
  
  <p>how can I get <code>"my%20string"</code> ?</p>
  
  <p>Thanks for any help !</p>
  
  <h2>P.S.:</h2>
  
  <p>Maybe I can do <code>str_replace(urlencode(),etc);</code>
  but is there an argument for urlencode so that it converts correctly by itself?</p>
  
  <h2>P.S. 2:</h2>
  
  <p>Turns out that, as Amal Murali said, <code>rawurlencode()</code> WAS doing it, I just didn't see it on the browser, when I hover on the link with my mouse.</p>
  
  <p>But when I check the source code, or click on the link, I see that <code>rawurlencode();</code> produces the correct link. (With <code>%20</code>'s.).</p>