Ok I found an answer PHP - split a string of HTML attributes into an indexed array
Thank's
I wanna replace every white space character between quotes with %20
Example:
<input type="text" title="this is a fish">
Desired result:
<input type="text" title="this%20is%20a%20fish">
Another example
$_POST['foo'] = '<input type="text" title="this is a fish">';
$parsed = '<input type="text" title="this%20is%20a%20fish">';
As seen I only whant to replace the spaces within the qoutes, not any other.
So str_replace
simply will not help here
The desierd end result of this is an array of the parameters
This is what I did
<?php
$tag_parsed = trim($tag_parsed);
$tag_parsed = str_replace('"', '', $tag_parsed);
$tag_parsed = str_replace(' ', '&', $tag_parsed);
parse_str($tag_parsed, $tag_parsed);
But when a parameter has a space, it breaks.