Reading data from a file

From: Date: Fri, 23 Feb 2001 05:48:50 +0000
Subject: Reading data from a file
Groups: php.windows 
Request: Send a blank email to php-windows+get-5707@lists.php.net to get a copy of this message
Perhaps the php gurus can help with my problem. I am using php4.0 +windows NT 4.0+Apache to read data from a text file ( a list of real numbers). I need to have the the data in the form {data1,data2,data3,...,0}. Here is some code: $elemdata=file("noisydata.dat"); $number=count($elemdata); $stringdata="{"; for ($i=0;$i<$number;$i++){ $stringdata.=$elemdata[$i].","; } $stringdata.="0}"; So far so good. Now I need to add this data as a query string to a url: $url="http://www......?stringdata=$stringdata"; and then read the output back into the browser $fp1=file($url); $x=0; while($fp1[$x]) echo $fp1[$x++]; When I use this approach I get a file handler error. I found that I can get around the problem by replacing the line $stringdata.=$elemdata[$i].","; with $stringdata.=(string)(real)$elemdata[$i].","; What gives? In the first instance $elemdata is already string. Why must I go through two type cast changes to get this to work! I would really like to know the reason behind this quirk. Thanks much Brian

« previous php.windows (#5707) next »