ID: 42726
Updated by: [EMAIL PROTECTED]
Reported By: jfcouic at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: windows or all
PHP Version: 5.2.4
New Comment:
We can't provide special constructs for every need.
Previous Comments:
------------------------------------------------------------------------
[2007-09-21 12:28:26] jfcouic at hotmail dot com
Description:
------------
Could it be possible to have a new structure instruction to "foreach"
?
I know that it possible to write with existing instructions but it
could be usefull to have this one. It could easily replace some code
block like "if(){try{foreach{}catch{}}}else{}" and provide more
efficient and "bug disable" code...
See the code, it's only a purpose.
Reproduce code:
---------------
$ar = array(0=>"one", 1=>"two");
foreach($ar as $ix $v) {
catch begin {
print "<table>";
print "<caption>My array have ".count($ar)." elements</caption>";
print "<tr><th>MyH1</th><th>...</th></tr>";
}
catch end {
print "</table>";
}
catch each {
print "<tr><th>$ix</th><th>$v</th></tr>";
}
catch null {
print "oups! my array is empty";
}
catch exception $ex {
print "oups! my code is so ugly that it done an error exception.";
}
}
Expected result:
----------------
<table>
<caption>My array have 2 elements</caption>
<tr><th>MyH1</th><th>...</th></tr>
<tr><th>0</th><th>one</th></tr>
<tr><th>1</th><th>two</th></tr>
</table>
Actual result:
--------------
oups! this instruction do not exists.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42726&edit=1