Click to See Complete Forum and Search --> : HELP with list() and split()


damon2003
11-10-2003, 06:49 PM
Hi,
I am pulling 3 values from a database, concatenating them into one variable and separating each value with
---
I just chose --- because it is unlikely to appear in the database. There is a good reason for doing this but is too long to explain here.

This works fine until I encounter double quotation marks in the data ". I seem to lose data after the quotation marks.
Does anybody know how to get around this problem? Prferably by modifying the code I have below,
thanks a lot


list ($data1, $data2, $data3) = split("---", $str);

echo $data1;
echo "<BR>";
echo $data2;
echo "<BR>";
echo $data3;

DaiWelsh
11-11-2003, 10:38 AM
I am not sure why quotes would be a problem, but split uses regular expression as first param and - can hold special menaing in regex (character range) so you would be better with explode() for a simple string like that.

HTH,

Dai