Solved

PHP - convert %20 back to blank space

Posted on 2013-06-16
3
937 Views
Last Modified: 2013-06-16
Hi,
how do I convert %20 back to an actual space?

From

$myvar = 'myweb.com/225/About_Our_Shopping_Cart/LINK%20Online%20Shop';

to

$myvar = 'myweb.com/225/About_Our_Shopping_Cart/LINK Online Shop';

Open in new window

0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 39252155
You could use 'str_replace' but the question is why would you want to?  Actual spaces can cause problems in URLs and that is the normal way to handle that.  Web servers normally convert %20 to a plain space anyway.  I always remove spaces from directory and file names.

http://php.net/manual/en/function.str-replace.php
0
 
LVL 12

Assisted Solution

by:sivagnanam chandrakanth
sivagnanam chandrakanth earned 250 total points
ID: 39252178
use urlencode http://php.net/manual/en/function.urlencode.php

$myvar = urlencode('myweb.com/225/About_Our_Shopping_Cart/LINK%20Online%20Shop');
0
 

Author Comment

by:sabecs
ID: 39252200
Thanks for your feedback, reason to remove them is because I pass URL to a another page and process the link.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Pagination 1 45
Generate PDF from MySQL using PHP 3 54
PHP function parameters defined 14 42
PHP Curl Problem 10 41
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question