dbillings Posted August 28, 2007 Share Posted August 28, 2007 I can't get my array's to echo. The diplay pukes out the following. IP: Array Unix: IP: Array Unix: <?php ############################## ### Users online script ### ver. 8/26/07 ############################## $ip = $_SERVER['REMOTE_ADDR']; $filename = "usersonline.txt"; if (is_writable($filename)) { $handle = fopen($filename, "r"); if (filesize($filename) > 0) { $contents = fread($handle, filesize($filename)); fclose($handle); } $handle = fopen($filename, "a"); $iptime = $_SERVER['REMOTE_ADDR']."@@@@".time()."****"; $seperate = explode("****", $contents); $remote_addr = array(); $time_out = array(); foreach ($seperate as $value) { list($remote_addr[], $time_out[]) = split('@@@@', $seperate); } if (count($remote_addr) == count($time_out)) { $counter = count($remote_addr); for ($i=0; $i < $counter; $i++) { // I cant' get this array to display. // Neither $remote_addr nor $time_out display. Any ideas? echo "IP: "; echo $remote_addr[$i]; echo " Unix: "; echo $time_out[$i]; echo " <br />"; } } if (fwrite($handle, $iptime) === FALSE) { echo "File: $filename cannot be written too."; exit; } fclose($handle); }else{ echo "The $filename is not writable."; } ?> Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/ Share on other sites More sharing options...
MadTechie Posted August 28, 2007 Share Posted August 28, 2007 do a print_r($remote_addr), so check the array, it should reveal the problem Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/#findComment-335847 Share on other sites More sharing options...
dbillings Posted August 28, 2007 Author Share Posted August 28, 2007 Thanks my brotha from anotha mutha. I'll give that a try. Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/#findComment-335849 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.