After reading the file into a variable ($file_contents =
file_get_contents($file_name)) and then use the explode() function to
split it up:

$exploded = explode("|",$file_contents);

The contents will now be in an array, split up by the pipe.  

Hope this at least gets you started...

Conor 



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Marian Briones
Sent: Tuesday, January 03, 2006 12:45 PM
To: [email protected]
Subject: [php-list] Doing a Split the way I used to do it in perl -
overwhelmed with options

Hi gang
I'm trying to export data from a pipe delimited file (|) with php,
trying to get away from perl entirely.

My old perl script opens the file and sticks it in an array, then
handles each line as a record in the database table by splitting the
line like this:

($MLSNo, $Status,  $DOM, $Address, $Unit, $City, $Area, $LP, $SP, $BT,
$SqFt, $Bed, $Bth, $PB, $Gar, $Garno, $YrBlt, $TBMap, $Acres,
$LotSqFt, $HOA, $Freq) = split (/\|/,$i);

How can I achieve the same with php??????





Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links



 






Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to