Re: split ...

From: Date: Tue, 04 Nov 2003 15:53:30 +0000
Subject: Re: split ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168477@lists.php.net to get a copy of this message
From: "Dan Joseph" <djoseph@duhq.us> > I'm getting the following error: > > [Tue Nov 4 10:01:53 2003] [error] PHP Warning: split() [<a > > href='http://www.php.net/function.split'>function.split</a>]: > REG_EMPTY in > /usr/local/apache/htdocs-chm/import_data.php on line 26 > > Here is the code in question: > > $line = fgets( $file ); > > echo $line . "<br>"; > > list ( $ACTION_DESCR, > $LOAN_NUMBER, > $BORROWER, > $CO_BORROWER, > $ADDRESS, > $CITY, > $STATE, > $ZIP, > $ABANUM, > $BANKACCTTYPE, > $BANKACCTNUM, > $ADD_PRINCIPAL, > $DAYS_TRANSFER, > $FILE_NAME, > $DATE_CREATED ) = split( "|", $line ); The | character is a special character in regular expressions, which split() expects. So, you can use split("\|",$line) which escapes the | character. Although, since you're not really using a regular expression, you'd be better off (more efficient) to just use explode('|',$line) and have the same effect. ---John Holmes...

« previous php.general (#168477) next »