ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#44953 [Opn]: Variable variables dont work in foreach
by Ies_clan At Hotmail Dot Com other posts by this author
May 9 2008 3:27AM messages near this date
#44953 [Opn->Bgs]: Variable variables dont work in foreach | #44952 [NEW]: isset() does not checks correctly variable variable
ID:               44953
 User updated by:  ies_clan at hotmail dot com
 Reported By:      ies_clan at hotmail dot com
 Status:           Open
 Bug Type:         Variables related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

oh sry i interchanges the field...

Expected result:
----------------
0
1
2

Actual result:
--------------
1
2


Previous Comments:
------------------------------------------------------------------------

[2008-05-09 09:58:03] ies_clan at hotmail dot com

Description:
------------
If you try to use Variable variables in a foreach, the output of the
array is wrong

Reproduce code:
---------------
$array = Array(
	0 =>  Array('11', '12', '13'), 
	1 =>  Array('21', '22', '23'), 
	2 =>  Array('31', '32', '33')
);
$key 	= 'key';
$value 	= 'value';
foreach($array AS ${$key} =>  ${$value}){
	echo ${$key}." -\n";
}

Expected result:
----------------
1
2

Actual result:
--------------
0
1
2


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44953&edit=1
Thread:
Ies_clan At Hotmail Dot Com
colder
Ies_clan At Hotmail Dot Com

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved