Re: Problems converting strings with 0 to integer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4 November 2010 10:33, Richard Quadling <rquadling@xxxxxxxxx> wrote:
> <?php
> // Create test file.
> $s_TabbedFilename = './test.tab';
> file_put_contents($s_TabbedFilename, "0\t00000002" . PHP_EOL .
> "4\t00000004" . PHP_EOL);
>
> // Open test file.
> $fp_TabbedFile = fopen($s_TabbedFilename, 'rt') or die("Could not open
> {$s_TabbedFilename}\n");
>
> // Iterate file.
while(False !== ($a_Line = fgetcsv($fp_TabbedFile, 0, "\t")))
	{
	var_dump($a_Line);
	foreach($a_Line as $i_Index => $m_Value)
		{
		$a_Line[$i_Index] = intval($m_Value);
		}
	var_dump($a_Line);
	}
>
> // Close the file.
> fclose($fp_TabbedFile);
>
> // Delete the file.
> unlink($s_TabbedFilename);


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux