06/02_namespace1.php


  1  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  2  <html>
  3  <head>
  4    <meta http-equiv="Author" content="Imrich BURANSKY" />
  5    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1250" />
  6    <title>Namespace - teória</title>
  7  </head>
  8  <body>
  9  <div>
 10  <h2>Namespace - teória</h2>
 11  <?php
 12  namespace Math { // Parse error: parse error, unexpected T_STRING
 13  
 14    class Complex {
 15      //...code...
 16      function __construct() {
 17        print("hey");
 18      }
 19    }
 20  }
 21  
 22  $m = new Math::Complex();
 23  ?>
 24  <!--  *** Výsledok ***
 25  
 26  Parse error: parse error, unexpected T_STRING in C:\!IB\! Publikacie\!PC_Revue\PHP5\Priklady\06\02_namespace1.php on line 12
 27  
 28  -->
 29  </div>
 30  </body>
 31  </html>

« Spä