I'm trying to use the parse_str function of php by stringing a value with the + character, but the result returns me the string without that character, see: p>
parse_str("c=item1 + item2");
var_dump($c);
I'm trying to use the parse_str function of php by stringing a value with the + character, but the result returns me the string without that character, see: p>
parse_str("c=item1 + item2");
var_dump($c);
This is the scope
void parse_str ( string $encoded_string [, array &$result ] )
Therefore, code the non-ascii characters before passing the function:
parse_str(urlencode('c=item1 + item2'));
There are other peculiarities about this function. See the manual to learn more: link
The case has been resolved this way:
$str = urlencode('item1 + item2');
parse_str("c={$str}");