Comparing arrays

From: Date: Thu, 29 Jun 2000 23:23:40 +0000
Subject: Comparing arrays
Groups: php.general 
Request: Send a blank email to php-general+get-3920@lists.php.net to get a copy of this message
im not entirely sure if there is a good way to do this, but heres what i want to do.. read $dir = "/foo/bar/"; $array_compare( "file1.txt" ,"file2.txt" ,"dir/file1.txt" ,"dir/file2.txt" ,"dir2/file1.txt" ); Now, what i want to do, is read a directory listing, and match it to the array. the directory listing would like like so. /foo/bar/file1.txt /foo/bar/file2.txt /foo/bar/dir/file1.txt /foo/bar/dir/file2.txt /foo/bar/dir2/file1.txt And, if they all exist, parse each file replacing %%VAR%% with the proper variable, and then placing them into the proper directory (replace $dir with $install_path). what i was going to do, is if each file exists, rewind the array, and then parse each array, replacing what i need into a new string, then writing the string to disk. (and making a directory if needed) while(list($n,$file) = each($array)){ $f_contents = file($file); ..parse $file through regex.. f_write = fopen($newdir.$file,"w"); fwrite($f_write,$string); fclose($f_write); } Of course, with proper syntax and no type-o's. Anyone have any ideas ?? thanks, bjorn

« previous php.general (#3920) next »