Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Get the Compatibility info for a chunk of code
4
 *
5
 * This example show the new options|features available with API 1.8.0
6
 *
7
 * PHP versions 4 and 5
8
 *
9
 * @category PHP
10
 * @package  PHP_CompatInfo
11
 * @author   Laurent Laville <pear@laurent-laville.org>
12
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD
13
 * @version  CVS: $Id: pci180_parsestring.php,v 1.3 2008/07/22 20:26:45 farell Exp $
14
 * @link     http://pear.php.net/package/PHP_CompatInfo
15
 * @since    version 1.8.0b2 (2008-06-03)
16
 * @ignore
17
 */
18
 
19
require_once 'PHP/CompatInfo.php';
20
 
21
/*
22
   With all default options, its same as version 1.8.0b1 or less
23
   No need to specify driver type ('array') and options, in class constructor
24
   Results display made with PHP::var_export
25
*/
26
//$compatInfo = new PHP_CompatInfo();
27
 
28
/*
29
   With API 1.8.0 you may choose a custom render,
30
   between all default renderers (all customizable).
31
 
32
   Here we choose to display result as XML stream, beautified if PEAR::XML_Beautifier
33
   package is available (installed).
34
 */
35
$driverType = 'xml';
36
 
37
// use some options of XML_Beautifier to change default render
38
$driverOptions = array('beautifier' => array('indent' => ' ', 'linebreak' => PHP_EOL));
39
 
40
$compatInfo = new PHP_CompatInfo($driverType, $driverOptions);
41
 
42
$source = '<?php
43
$nl = "\n";
44
echo "$nl Atom    = " . DATE_ATOM;
45
echo "$nl Cookie  = " . DATE_COOKIE;
46
echo "$nl Iso8601 = " . DATE_ISO8601;
47
echo "$nl Rfc822  = " . DATE_RFC822;
48
echo "$nl Rfc850  = " . DATE_RFC850;
49
echo "$nl Rfc1036 = " . DATE_RFC1036;
50
echo "$nl Rfc1123 = " . DATE_RFC1123;
51
echo "$nl Rfc2822 = " . DATE_RFC2822;
52
echo "$nl RSS     = " . DATE_RSS;
53
echo "$nl W3C     = " . DATE_W3C;
54
?>';
55
 
56
$r = $compatInfo->parseString($source);
57
// You may also use the new unified method parseData(), parseString() became an alias
58
//$r = $compatInfo->parseData($source);
59
 
60
/*
61
   To keep backward compatibility, result is also return (here in $r)
62
   but you don't need to print it, it's the default behavior of API 1.8.0
63
 */
64
var_export($r);
65
?>