TechniqueUse the explode() function to divide your string into an array from your specified record separator: <?php $line = explode (':', $line); ?> Or, if you need more power, use the preg_split() function to tear apart your string: <?php // split HTML by tags $text = preg_split ('/<[^>]+>/', $html); ?> CommentsSeparating records by text can be extremely useful if you have large text files and the normal line break just won't cut it as a separator. This is especially appropriate when handling binary file uploads with enormous sizes. Use the explode() function whenever possible because it gives a great speed increase over the preg_split() function. However, if you need more power, the preg_split() function is about as powerful as you can get. |