Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading text and manipulating with php

Status
Not open for further replies.

solex

Programmer
Feb 28, 2003
91
GB
Hello all programmers.

I would like any help to do the following:

1. dowload a txt file from a users computer by a web browser interface.

2. Put all the contence into a varible.

3. Split it up into lines into an array (i know that this can be done by explode() but im not sure how i use it with line breaks)

4. Check each line in turn for if the first charictor is a #

5. if not then split the var up by tabs

phew thats it. I dont kneed all the code, just examples of the functions.

Thanx
solex

 
im a bit confused about preg_match()

if i had the line in $lines[21] what would the function be like to look for #?

thanx in advance
solex
 
Now that I think about it, preg_match() is not the best function to use. Looking for so trivial a pattern is proabably not worth the resource overhead of running the regular expression engine.

If you only need to examine the leftmost character of a string, then comparing $lines[21]{0} to '#' will work. The "curly brace" notation is documented in the online manual entry for substr()



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top