How to encode only 2 chars in path?

Koecoe

New Member
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:\[code\]str_replace($string, array('@', '#'), array('%40', '%23'));\[/code\]My full Delete path looks like this:\[code\]$delete = "http://admin:[email protected]/@api/deki/DELETE:users/$user_id/properties/%s";\[/code\]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:\[code\]foreach($xml->property as $property) { $name = $property['name']; // the name is stored in the attribute curl_fetch(sprintf($delete, $name),'admin','12345'); }\[/code\]Each property contains a '#', so is there a way that each iteration which modify '#' to be the appropriate value?Thanks in advance.
 
Back
Top