#43881 [NEW]: Example #1 for class constants shows error
| From: | paramount_98 at hotmail dot com | Date: | Thu, 17 Jan 2008 18:04:21 +0000 |
| Subject: | #43881 [NEW]: Example #1 for class constants shows error | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-447@lists.php.net to get a copy of this message | ||
From: paramount_98 at hotmail dot com
Operating system: RHEL 5
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Example #1 for class constants shows error
Description:
------------
Run example #1 on PHP 5.2.5 produces parse error.
Reproduce code:
---------------
<?php
class MyClass
{
const constant = 'constant value';
function showConstant() {
echo self::constant . "\n";
}
}
echo MyClass::constant . "\n";
$classname = "MyClass";
echo $classname::constant . "\n";
$class = new MyClass();
$class->showConstant();
echo $class::constant."\n";
?>
Expected result:
----------------
outputs 'constant value'
Actual result:
--------------
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting
',' or ';' in /www/mydomain.com/httpdocs/class-constant-test.php on line 14
--
Edit bug report at http://bugs.php.net/?id=43881&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43881&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43881&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43881&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43881&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43881&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43881&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43881&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43881&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43881&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43881&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43881&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43881&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43881&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43881&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43881&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43881&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43881&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43881&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43881&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43881&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43881&r=mysqlcfg