06/02_namespace2.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 - pokus</title>
  7  </head>
  8  <body>
  9  <div>
 10  <h2>Namespace - pokus</h2>
 11  <?php
 12  class Math
 13  { // Trieda v triede
 14    class Complex { // Parse error: parse error, unexpected T_CLASS, expecting T_FUNCTION
 15      //...code...
 16      function __construct() {
 17        print("hey");
 18      }
 19    }
 20  }
 21  $m = new Math::Complex();  //  Pouzil by sa operator Paamyim Nekudotayim
 22  ?>
 23  <!--  *** Výsledok ***
 24  
 25  Parse error: parse error, unexpected T_CLASS, expecting T_FUNCTION in C:\!IB\! Publikacie\!PC_Revue\PHP5\Priklady\06\02_namespace2.php on line 14
 26  
 27  -->
 28  </div>
 29  </body>
 30  </html>

« Späť