Re: parse_str

From: Date: Mon, 18 Dec 2000 23:31:15 +0000
Subject: Re: parse_str
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30964@lists.php.net to get a copy of this message
> name=name_a&description=description_a > name=name_b&description=description_b > > In a php page I read the file line by line, I split it using parse_str() > and I display the resulting variables, $name and $description. > > The problem is if a description contains '+' sign, it is converted to > spaces. I tried using + instead of '+' signs but with no result. I > also tried using split() function but agains, I get spaces for every '+' > sign. > > So, how could I split a string that contains '+' signs and preserve > this signs after split? A plus should be %XX where XX is the Hex representation of the ASCII value of '+'... Your other option would be to use explode() instead of parse_str() or split(). parse_str() is going to use the URL rules such as changing %20 or + to a space. split() should not be doing that, I don't think, but *will* do some RegExp matching stuff which is overkill for what you probably need.

« previous php.general (#30964) next »