Strange loop problem, won't write to array

Help me there, what am I doing wrong ?


<?php
$handle = opendir('../sandbox/');
$counter = 0;
$fileArray = array();
	while (false !== ($file = readdir($handle))) {
		echo $file."</br>"; //this echoes files OK
		$fileArray[$counter] = $file;
		$counter++; //I used 'count($fileArray)' as array index before
	}
	printf($fileArray); // echoes blank - it just ouputs 'Array' to the page
closedir($handle);