$comp = "V1001|VI003";
$comp_arr = split("|",$comp);
i hit error:
PHP: Warning: split() [function.split]: REG_EMPTY in xxx
after search around and found that the issue is caused by symbol "|".
"|" is an operator in PHP. If want to use the this symbol as a delimiter, we must excape it with a back slash, "\|"
now it become
$comp = "V1001|VI003";
$comp_arr = split("\|",$comp);
and it works.
Hope this help
4 comments:
Oh man that helped alot, I couldn't figure out why I was getting that error for ereg_replace. Thanks!
Thanks, I was wondering about this error. I used || so I had to escape it like so, \|\|
Great post thank you so much...
thanks
Post a Comment