Solved

PHP - convert %20 back to blank space

Posted on 2013-06-16
3
886 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
3 Comments
 
LVL 82

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
resizeing PHP image 2 22
Help cleaning out CSS 2 31
showing numeric numbers 2 11
Post xml via PHP Soap Client 3 10
Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now