Questions
  • Problem Creating Simple Shopping Cart with PHP

  • Asked by Telly on 17th Oct 2016

can i ask how to change the current $current_url = urlencode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); echo $current_url; ?>" /> to dollar or to peso

    Add Answer

    1 Answer

      • Ajmal Praveen

      Some Guidance Regarding URI Query PHP Functions urlencode/urldecode, rawurlencode/rawurldecode.

      The difference between urlencode and rawurlencode is that

      urlencode encodes according to application/x-www-form-urlencoded (space is encoded with +) while

      rawurlencode encodes according to the plain Percent-Encoding (space is encoded with %20).

      I have re written the Code below

      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      <?php $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].''; $current_url = urlencode($url); echo $current_url; //will output encoded url echo urldecode($current_url); //will output the decoded raw url ?>

      Kindly make Changes to rawurlencode If your URL URI has Spaces

      Can You Answer this? Help us answer the question!

        • Answer
        Supports basic Markdown syntax.