PHP New Features

处理目录,文件
PHP5中使用大量Iterator,包括ArrayIterator,CachingIterator,LimitIterator,RecursiveIterator,SimpleXMLIterator和DirectoryIterator.

用PHP和PEAR比较文件内容提交输出,相信很多人在Unix/Linux下面都用过Diff命令,这个命令是个非常方便实用的工具,能够对不同文件进行逐行的对比,最后找出不同的地方。而PEAR提供了一个包,也是用来比较文件,Text_Diff   http://pear.php.net/package/Text_Diff 


include_once "Text/Diff.php";
include_once "Text/Diff/Renderer.php";
include_once "Text/Diff/Renderer/unified.php";
// define files to compare
$file1 = "data1.txt";
$file2 = "data2.txt";
// perform diff, print output
$diff = &new Text_Diff(file($file1), file($file2));
$renderer = &new Text_Diff_Renderer_unified();
echo $renderer->render($diff);

 

你可能感兴趣的:(linux,.net,PHP,unix)