php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #17052 problem with & operator and variables
Submitted: 2002-05-06 17:46 UTC Modified: 2003-02-25 01:56 UTC
From: jx at email dot cz Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.1.2 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: jx at email dot cz
New email:
PHP Version: OS:

 

 [2002-05-06 17:46 UTC] jx at email dot cz
this is ok

<?

$a=&$b;
$a=5;
echo($b);

?>



but when I declare these variables as globals in a function it doesn't work

<?

function foo() {
  global $a, $b;
  $a=&$b;
}

foo();
$a=5;
echo($b);

?>

It is probably allright. I didn't find anything about this problem.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-06 18:04 UTC] mfischer@php.net
This is due that variables imported into functions with the global statement are in fact references. There are open reports about this issue, marking it as duplicate for now (#14645).
 [2002-05-06 18:07 UTC] mfischer@php.net
Achja, and it's a documentation problem . . .
 [2003-02-25 01:56 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

bug #14645

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 00:01:30 2024 UTC