RE: [PHP] Splitting string

From: Date: Sun, 10 Dec 2006 19:27:22 +0000
Subject: RE: [PHP] Splitting string
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-245690@lists.php.net to get a copy of this message
Hi, > Ah, so it's not 50 space padding but columns at 50 characters, > space-padded? > > In that case, just use substr(). > > $var1 = substr($string, 0, 50); > $var2 = substr($string, 50, 50); > $var3 = substr($string, 100, 50); > > And then trim() if needed > > Of course, what it sounds like you really want is a file that is > formatted to > proper CSV in the first place so that you can use fgetcsv(). > Brilliant! Works fab ... thank you ... The file will always be the same format etc - so I this is brilliant... Ta Steven

« previous php.general (#245690) next »