php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #27855 setting up a constant with a value retrieved by a function
Submitted: 2004-04-03 15:49 UTC Modified: 2004-04-03 16:19 UTC
From: blackei2k at gmx dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.3.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: blackei2k at gmx dot de
New email:
PHP Version: OS:

 

 [2004-04-03 15:49 UTC] blackei2k at gmx dot de
Description:
------------
You can't define a constant using define(), and automatically assign a value to it, that is of a function.

Reproduce code:
---------------
<?php
 define("E_SQL", mysql_error(), true);
?>


Expected result:
----------------
E_SQL should now contain the last error-string. (Of course only if there was an error).

Actual result:
--------------
It's empty

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-03 16:19 UTC] pollita@php.net
Actually you can.

What you can't do is define() (read redefine) a constant more than once.  That's why it's called a constant.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 14:01:31 2025 UTC