How do I prevent php from converting string to integer/float? -
i'm trying process/parse text file contains upc codes products. every time read file, upcs being converted exponential notation. how can prevent this? (i've tried settype() gets ignored.)
<?php //input: 46563,,840253044815,106 12200-0 3-way lamp aston bronze 29x21x16 1-150m,07/06/2007,07/06/2007,nonstock,0,0,,ambience,ambience $lines = file ('./scripts/fullproductlist.csv'); $newlinedata = ""; $count = 0; // loop through array, foreach ($lines $line) { settype($linedata, "string"); $linedata = explode (",", "$line"); $count1++; echo "line:".$count1."::".$line."\n"; //output new line } //output: 46563,,8.40253e+11,106 12200-0 3-way lamp aston bronze 29x21x16 1-150m,7/6/2007,7/6/2007,nonstock,0,0,,ambience,ambience ?>
Comments
Post a Comment