I have a $delete path and a $user_id each include '#' and '@' respectively within the string. How can I replace each with the encoded value %23 and $40.
I tired using str_replace but did not have any luck:
str_replace($string, array('@', '#'), array('%40', '%23'));
My full Delete path looks like this:
$delete = "http://admin:[email protected]/@api/deki/DELETE:users/$user_id/properties/%s";
I feel like the $user_id should be pretty simple. For the properties it has to loop through to get all the available properties. You can see the loop below:
foreach($xml->property as $property) {
$name = $property['name']; // the name is stored in the attribute
curl_fetch(sprintf($delete, $name),'admin','12345');
}
Each property contains a '#', so is there a way that each iteration which modify '#' to be the appropriate value?
Thanks in advance.