cvs: pear /PHP_Compat/Compat/Function php_strip_whitespace.php
| From: | Aidan Lister | Date: | Fri, 27 Aug 2004 14:53:37 +0000 |
| Subject: | cvs: pear /PHP_Compat/Compat/Function php_strip_whitespace.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-23365@lists.php.net to get a copy of this message | ||
aidan Fri Aug 27 10:53:37 2004 EDT
Modified files:
/pear/PHP_Compat/Compat/Function php_strip_whitespace.php
Log:
basic functionality
http://cvs.php.net/diff.php/pear/PHP_Compat/Compat/Function/php_strip_whitespace.php?r1=1.1&r2=1.2&ty=u
Index: pear/PHP_Compat/Compat/Function/php_strip_whitespace.php
diff -u pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.1
pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.2
--- pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.1 Fri Aug 27 08:19:09 2004
+++ pear/PHP_Compat/Compat/Function/php_strip_whitespace.php Fri Aug 27 10:53:37 2004
@@ -15,7 +15,7 @@
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: php_strip_whitespace.php,v 1.1 2004/08/27 12:19:09 aidan Exp $
+// $Id: php_strip_whitespace.php,v 1.2 2004/08/27 14:53:37 aidan Exp $
/**
@@ -25,7 +25,7 @@
* @package PHP_Compat
* @link http://php.net/php_strip_whitespace
* @author Aidan Lister <aidan@php.net>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @since PHP 5
* @require PHP 4.0.1 (trigger_error)
*/
@@ -33,7 +33,17 @@
{
function php_strip_whitespace($file)
{
- return implode('', file($file));
+ // Load file
+ $file = implode('', file($file));
+
+ // Remove whitespace
+ // FIXME
+
+ // Remove comments
+ $file = preg_replace('#//[^\n]+#s', '', $file);
+ $file = preg_replace('#/\*.*\*/+#su', '', $file);
+
+ return $file;
}
}