Pulling Data From a Loop

From: Date: Mon, 26 Jun 2000 07:16:15 +0000
Subject: Pulling Data From a Loop
Groups: php.general 
Request: Send a blank email to php-general+get-3073@lists.php.net to get a copy of this message
Hello, I've constructed a script that outputs exactly what I want, however, I need to capture the output as a variable, how do I do this. I thought that if instead of using echo $buffer to output the data to the screen, I could use an array of some sort to capture the information into a variable $rdf2a[$i] = $buffer; I would like to be able to echo $rdf2a[] outside of the loop and get the same results that I did when I simply echo $buffer inside of the loop. Unfortunately, I haven't been able to figure out how to make this simple function work. <? $page3 = "wtowatch3.txt"; $fd = fopen("$page3", "r"); $i=1; while ($buffer = fgets($fd, 4096)) {  $buffer = eregi_replace( "(<link>.*</item>)(<title>.*</title>)", "\\2 \n \\1 \n", $buffer); $buffer = eregi_replace( "</link>", "</link>\n", $buffer ); echo $buffer; // $rdf2a[$i] = $buffer; i++; } fclose($fd); // echo $rdf2a[] ?> Thanks. Mike -- Mike A. Gifford OpenConcept Consulting Mike@OpenConcept.On.Ca Http://www.OpenConcept.On.Ca Web Design, Hosting, Graphic Design & Site Promotion Featured Site --> Http://WTOAction.Org

« previous php.general (#3073) next »