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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 02 14:01:32 2024 UTC