php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31557 -- doesn't initialize global variable
Submitted: 2005-01-14 19:31 UTC Modified: 2005-01-14 21:43 UTC
From: tim at tenkan dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.10 OS: debian linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tim at tenkan dot org
New email:
PHP Version: OS:

 

 [2005-01-14 19:31 UTC] tim at tenkan dot org
Description:
------------
if you use -- on a variable inside a loop in global scope, it doesn't initialize the variable.  ++ does.


Reproduce code:
---------------
<?php
while ($aglobal < 10) {
	$aglobal++;
	$j--;
	$another = $j;
}

print "aglobal $aglobal, j $j, another $another\n";
?>


Expected result:
----------------
aglobal 10, j -10, another -10


Actual result:
--------------
aglobal 10, j , another 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-14 21:43 UTC] tony2001@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. 

Thank you for your interest in PHP.

See #20548.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 23:01:33 2025 UTC