Re: remove characters, add newline & making a twodimensional array

From: Date: Wed, 25 Jun 2003 10:56:00 +0000
Subject: Re: remove characters, add newline & making a twodimensional array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-152736@lists.php.net to get a copy of this message
hi dore, Dore Van Hoorn wrote: > Well, i'm kind of a newby, but this is what i would like to do in php: > > 1. > i'm writing all instances of a mysql table to a txt file, but when i > add "\n" to go on on the next line, in the txt file there is a square > printed. > When i try to import the txt file into ms access, the square is not > recognized > by this program to represent a newline.. how can i add a newline to a > txt > file, that actually IS a newline (or better: hard return) and that > will be > recognized as one, when reading the file into another program? seems like you are using a windows-machine, so try '\r\n' instead of '\n'. > > 2. > a array contains a string of text, multiple words and interpunction. > my first > question: how can i remove the interpunction ( i know how to strip > slashes > and trim spaces..)? secondly, after this, i would like to count all > double > entries. f.e. when the word computer occurs twice in the sentence, i > would > like to make an array that is twodimensional: word-number of > occurences (f.e. 'computer' '2'). How do i do that, for i don't > really understand the phpmanual-explanation about this topic. And > thirdly: how do i get both facts (word and number) > out of the array? (all this has to produce a word-frequecylist, so if > anybody > has a clue how to do that......) a little bit confusing with your interpunctation, maybe you can provide some examples? to your array: why not using a mono-dimensional array with your words as key and the occurances as value? $words = array( 'myWord1' => 5, 'myWord2' => 3, ... ); or if you got your $word and $occurance in these vars: $words[$word] = $occurance; > > 3. > how can i upload an image to my server and then call the image back > into > a webpage, just by using php? there are some articles about uploading files. if you got te file on your server you can simply use the location in the next script: $location = /path/to/my.file; echo '<img source="'.$location.'" />'; (or: echo "<img source=\"$location\" />";) > +++++++++++++++++++++++++++++++++++ > N Dore van Hoorn > S s1000454 AlfaInformatica-RuG > E M.D.van.Hoorn@student.rug.nl > W http://www.let.rug.nl/~s1000454 > +++++++++++++++++++++++++++++++++++ ciao SVEN

« previous php.general (#152736) next »