title: URLencode numbers?
body: <p>I want to encode this</p>
  
  <p><code>广东路20号外滩5号7楼，近中山东一路</code>
  into this:</p>
  
  <p><code>%e5%b9%bf%e4%b8%9c%e8%b7%af%32%30%e5%8f%b7%e5%a4%96%e6%bb%a9%35%e5%8f%b7%37%e6%a5%bc%ef%bc%8c%e8%bf%91%e4%b8%ad%e5%b1%b1%e4%b8%9c%e4%b8%80%e8%b7%af</code><br>
  however <a href="http://my.php.net/urlencode" rel="nofollow">urlencode()</a> doesn't seem  to encode numbers and the api I need to use breaks at 20</p>
  
  <p><code>--------------------------v<br>
  %E5%B9%BF%E4%B8%9C%E8%B7%AF20%E5%8F%B7%E5%A4%96%E6%BB%A95%E5%8F%B77%E6%A5%BC%EF%BC%8C%E8%BF%91%E4%B8%AD%E5%B1%B1%E4%B8%9C%E4%B8%80%E8%B7%AF</code></p>
  
  <p>How can I encode alphanumeric characters to the target format?</p>
  
  <p><strong>From the answer I've created this function</strong></p>
  
  <pre><code>/**
   * urlencodes complete string, including alphanumeric characters
   * @param string $string the string to encode
   */
  function urlencode_all($string){
      $chars = array();
      for($i = 0; $i &lt; strlen($string); $i++){
          $chars[] = '%'.dechex(ord($string[$i]));
      }
      return implode('', $chars);
  }
  </code></pre>