Revision 19792,
803 bytes
checked in by Seasoft, 13 years ago
(diff) |
#744(PHP4 互換用途ソースを将来的に切り捨てやすい仕組みづくり)
|
Line | |
---|
1 | --TEST-- |
---|
2 | Function -- php_strip_whitespace |
---|
3 | --SKIPIF-- |
---|
4 | <?php |
---|
5 | if (function_exists('php_strip_whitespace') || |
---|
6 | !extension_loaded('tokenizer')) { |
---|
7 | |
---|
8 | echo 'skip'; |
---|
9 | } |
---|
10 | ?> |
---|
11 | --FILE-- |
---|
12 | <?php |
---|
13 | require_once 'PHP/Compat.php'; |
---|
14 | PHP_Compat::loadFunction('php_strip_whitespace'); |
---|
15 | |
---|
16 | // Here is some sample PHP code to write to the file |
---|
17 | $string = '<?php |
---|
18 | // PHP comment here |
---|
19 | |
---|
20 | /* |
---|
21 | * Another PHP comment |
---|
22 | */ |
---|
23 | |
---|
24 | echo php_strip_whitespace($_SERVER[\'PHP_SELF\']); |
---|
25 | // Newlines are considered whitespace, and are removed too: |
---|
26 | do_nothing(); |
---|
27 | ?>'; |
---|
28 | |
---|
29 | // Create a temp file |
---|
30 | $tmpfname = tempnam('/tmp', 'phpcompat'); |
---|
31 | $fh = fopen($tmpfname, 'w'); |
---|
32 | fwrite($fh, $string); |
---|
33 | |
---|
34 | // Test |
---|
35 | echo php_strip_whitespace($tmpfname); |
---|
36 | |
---|
37 | // Close |
---|
38 | fclose($fh); |
---|
39 | ?> |
---|
40 | --EXPECT-- |
---|
41 | <?php |
---|
42 | echo php_strip_whitespace($_SERVER['PHP_SELF']); do_nothing(); ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.