...

View Full Version : substr_replace with the < character?



gorilla1
03-21-2009, 05:59 PM
If I want to replace a character in a string with the character '<', how do I do this? Anything I try, including escaping like so:
substr_replace($rs, '\<?', 0 ) causes an error.
This is what I would like to to do:

$rs = "1?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";

$rs = substr_replace($rs, '<?', 0 );
so that rs will equal:
<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>

G

oesxyl
03-21-2009, 06:10 PM
If I want to replace a character in a string with the character '<', how do I do this? Anything I try, including escaping like so:
substr_replace($rs, '\<?', 0 ) causes an error.
This is what I would like to to do:

$rs = "1?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";

$rs = substr_replace($rs, '<?', 0 );
so that rs will equal:
<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>

G
try this:


$rs = substr_replace($rs,'<',0,1);


best regards

gorilla1
03-21-2009, 06:28 PM
awesome -- thanks -- that did work



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum