php writing array in a text file fails, why?
Posted
by Tarique Imam
on Stack Overflow
See other posts from Stack Overflow
or by Tarique Imam
Published on 2010-04-21T17:15:09Z
Indexed on
2010/04/21
17:33 UTC
Read the original article
Hit count: 305
trying to write an array to a text file, but it is failed, can anybody say, WHY?
$filename= 't12a';
for ($pnum = 1; $pnum <= 15; $pnum++){
$bbal = 3;
$ipmnt = 14 * 5;
$ppmnt = 26 - 7;
$ebal = 48 - 4;
$ccint = 54 + 45;
$cpmnt = 25 + 54;
$db_data_txt[] = array('pn' => $pnum, 'bb' => sprintf("%01.2f",$bbal),'ip'=>sprintf("%01.2f",$ipmnt),'pp'=>sprintf("%01.2f",$ppmnt),'eb'=>sprintf("%01.2f",$ebal),'ci'=>sprintf("%01.2f",$ccint),'cp'=>sprintf("%01.2f",$cpmnt));
}
$con= $db_data_txt;
if ( ! write_file("./files/{$filename}.doc", $con))
{
echo 'Unable to write the file';
}
else
{
echo 'File written!';
}
© Stack Overflow or respective owner