Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
5,151 captures
04 Sep 2004 - 12 Feb 2026
AugSEPOct
04
200320042005
success
fail
COLLECTED BY
Organization:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
Collection:Alexa Crawls DY
Crawl data donated by Alexa Internet. This data is currently not publicly accessible
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20040904003007/http://www.php.net:80/manual/en/language.oop5.constants.php
PHP 
downloads |documentation |faq |getting help |mailing lists |reporting bugs |php.net sites |links |my php.net 
search forin the 
<Static KeywordObject Abstraction>
view theversion of this page
Last updated: Sat, 28 Aug 2004

Object Constants

It is possible to define constant values on a per-class basis remaining the same and unchangeable. Constants differ from normal variables in that you don't use the$ symbol to declare or use them. Likestatic members, constant values can not be accessed from an instance of the object.

Example 18-13. Defining and using a constant

<?php
classMyClass{
  const
constant='constant value';

  function
showConstant() {
   echo 
self::constant."\n";
  }
}

echo
MyClass::constant."\n";

$class= newMyClass();
$class->showConstant();
/* echo $class::constant;  is not allowed */
?>


add a noteadd a noteUser Contributed Notes
Object Constants
There are no user contributed notes for this page.

<Static KeywordObject Abstraction>
 Last updated: Sat, 28 Aug 2004
show source |credits |sitemap |contact |advertising |mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This mirror generously provided by:Web Hosting Talk
Last updated: Fri Sep 3 20:17:12 2004 EDT

[8]ページ先頭

©2009-2026 Movatter.jp