I am using Adobe flex to write 10Mb of array(containing integers) to a bin file(text file) using PHP. But I am unable to get the file, as the PHP is getting crashed each time I am trying to send the array.
Below is the PHP code, I am using to write an array to .bin file
$Text = $_POST["first"];
$arr = explode(",",$Text);
$myFile = "test1.bin";
$count=count(explode(",",$Text));
echo sizeof($arr);
$fh = fopen($myFile, 'a') or die("can't open file");
for($i=0;$i<sizeof($arr);$i++)
{
$sd=pack(V,$arr[$i]);
fwrite($fh,"$sd");
}
fwrite($fh,$str);
fclose($fh);
The problem is in PHP code, as the array if successfully passed from flex, so that's why I am posting only PHP.
Please let me know, the alternate way or the correct way of working.
Thanks