Try this, but if your problem is TAGS HTML use "htmlentities($x)"
<?
$x="
Volume in drive C is Windows
Volume Serial Number is 709C-8A2E
Directory of C:\
24/01/2004 01:32 0 AUTOEXEC.BAT
23/08/2004 17:04 <DIR> Batch
24/01/2004 01:27 32 CONFIG.SYS
19/12/2003 02:16 <DIR> Documents and Settings
11/01/2004 16:54 <DIR> IE Builds
14/01/2004 21:24 <DIR> Inetpub
11/02/2004 23:02 <DIR> Lynx
07/01/2004 00:04 30 mysql.bat
20/07/2004 21:34 <DIR> Program Files
25/08/2004 20:31 <DIR> Temp
01/10/2003 14:05 20'480 TickCount.exe
26/08/2004 17:25 22 weather.txt
23/08/2004 18:03 <DIR> WebSoft
26/08/2004 12:25 <DIR> WINDOWS
26/08/2004 12:25 <DIRECTORY> WINDOWS
26/08/2004 12:25 <DIRECTORY> WINDOWS
6 File(s) 1'024'624 bytes
10 Dir(s) 18'616'840'192 bytes free";
echo preg_replace( '/<(.*?)>/i', '[\1]', $x );
?>