$content = "";
foreach (glob("d:\\d*.txt") as $filename) {
$content .= file_get_contents($filename) . "\n";
}
file_put_contents("d:\\all.txt", $content);
/*
run:
all.txt
-------
python
java
c#
c
c++
a b c
python programming
Programming is fun
Java
C#
C++
PHP
php programming
text file
PHP
For web applications
Is popular on the net
*/