Page 1 of 1

using an escape functionality within the split function

Posted: Tue Aug 26, 2003 4:58 pm
by twindu
I have the following comma delimited string which I am trying to use the split function on

Address,Contact Info,<serial number>,"GPA",12345678890123456

for some reason.... <serial number> is being replaced with a blank space....
can someone please explain why this is happening and give me a possible solution

Posted: Wed Aug 27, 2003 4:33 pm
by JAM

Code: Select all

<pre>
<?php
$string = 'Address,Contact Info,<serial number>,"GPA",12345678890123456';
$foo = split(',',$string);
print_r($foo);
?>
The above works fine. But, using my debugging method print_r, you will still get the blank line. Or so it seems.
If you run this on a clean page, and then viw the source, you'll see the <serial number> as it is.

The browser just tries to use it as a html-tag...
Either remove the <>'s or convert them into ascii/htmlentities etc.