php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31554 can't assign function output to class constant
Submitted: 2005-01-14 16:16 UTC Modified: 2005-01-14 19:48 UTC
From: pcarmody at c-spanarchives dot org Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.0.3 OS: SunOS 5.8
Private report: No CVE-ID: None
 [2005-01-14 16:16 UTC] pcarmody at c-spanarchives dot org
Description:
------------
Attempting to use a function to generate the value for assignment to a class constant causes a parse error.


Reproduce code:
---------------
<?php
class MyClass {
  const good = "Blah";  // will work
  const bad = substr(0, 3, "Blah");  // results in parse error
}
?>

Actual result:
--------------
Parse error: parse error, unexpected '(', expecting ',' or ';'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-14 19:48 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC