Reputation: 5300
<?php
function aum($x) {
$contents = $_FILES['userfile']['tmp_name'];
$contents = file("$contents");
$aum = $contents[$x][13].$contents[$x][14].$contents[$x][15].$contents[$x][16].$contents[$x][17].$contents[$x][18].$contents[$x][19].$contents[$x][20].$contents[$x][21].$contents[$x][22].$contents[$x][23];
$faum = money_format('%(#1n',$aum)."\n";
return $faum;
}
?>
Notice: A non well formed numeric value encountered in ./includes.php on line 28
Hi,
I'm getting the error above. Line 28 is: $faum = money_format('%(#1n',$aum)."\n";
I have three questions:
I appreciate any tips/advice that you might share.
thx,
Upvotes: 2
Views: 15235
Reputation: 19305
For CSV parsing, a hand on approach is to use explode. I try this snippet of code
$string = "a,,b";
$result = explode(",", $string);
echo "<pre>".print_r($result, true)."</pre>";
And the output I get back is:
Array
(
[0] => a
[1] =>
[2] => b
)
Upvotes: 1
Reputation: 11583
for the second question, fgetcsv is your friend to get data out of CSV files
Upvotes: 1
Reputation: 250882
You need to have a look at $aum as it probably can't be formatted as a number.
Pop
echo $aum;
echo floatval($aum);
Before the error to see what you get. You might need to change the position you're looking at if you're picking up leading or trailing data.
Upvotes: 3