ted_chou12 Posted December 14, 2006 Share Posted December 14, 2006 Here, i have to string:$figure_1 = 1$figure_2 = 2does php work with simple + symbol?eg.$figure_1 + $figure_2 == 3does this work? Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/ Share on other sites More sharing options...
taith Posted December 14, 2006 Share Posted December 14, 2006 yes... it should... Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141204 Share on other sites More sharing options...
timmah1 Posted December 14, 2006 Share Posted December 14, 2006 Yes it does work[code]$a= 5;$b = 5;$c = ($a+$b);echo "$c";[/code] Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141205 Share on other sites More sharing options...
redbullmarky Posted December 14, 2006 Share Posted December 14, 2006 yes.did you try it before you asked? Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141206 Share on other sites More sharing options...
ted_chou12 Posted December 14, 2006 Author Share Posted December 14, 2006 opps :-[ sorry... Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141207 Share on other sites More sharing options...
ted_chou12 Posted December 14, 2006 Author Share Posted December 14, 2006 but thanks for everyone's active participation!! :D Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141209 Share on other sites More sharing options...
ted_chou12 Posted December 14, 2006 Author Share Posted December 14, 2006 i have infinite number of files in a folder, and each of those txt files has a number, what i want is add all of those numbers together,so far, this is what ive got$namearray = array("forum"); // File names you want to exclude$extarray = array("xml","jpg","php","css","bmp","png","html"); //extension you want to exclude$files = array();if ($handle = opendir(".")) { while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".."){ if (filetype($file) == "file" || filetype($file) == "dir"){ $filearray = explode(".", $file); $files[$filearray[0]] = $filearray[1]; } } }closedir($handle);}foreach($files as $name => $ext){ if(in_array($name, $namearray, false) || in_array($ext, $extarray, false)){ } else { foreach(@file("homework/$name.txt") as $v){list($topic,$category,$number,$datetime,$name,$username,$message) = explode("#",$v);} $repliesaa = file_get_contents("topic$number-replies.php")."\n";}it lists out the txt files but i am having trouble adding the numbers up, can anyone give me some ideas Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141222 Share on other sites More sharing options...
utexas_pjm Posted December 14, 2006 Share Posted December 14, 2006 infinite number of files eh? I need to get me one of those HD's ;)Try this... count will hold your number of files.[code]...$count = 0;foreach($files as $name => $ext){ ++ $count; if(in_array($name, $namearray, false) || in_array($ext, $extarray, false)){ } else { foreach(@file("homework/$name.txt") as $v){list($topic,$category,$number,$datetime,$name,$username,$message) = explode("#",$v);} $repliesaa = file_get_contents("topic$number-replies.php")."\n";}[/code] Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141261 Share on other sites More sharing options...
ted_chou12 Posted December 14, 2006 Author Share Posted December 14, 2006 :D, haha, yeah, i was kind of exaggerting, thankyou for solving my problem by the way! Link to comment https://forums.phpfreaks.com/topic/30650-1-2-3-add-up-of-infinite-text-counter-files/#findComment-141282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.