note 53217 deleted from control-structures.foreach by felipe
| From: | felipe@php.net | Date: | Tue, 29 Jan 2008 11:24:57 +0000 |
| Subject: | note 53217 deleted from control-structures.foreach by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-135525@lists.php.net to get a copy of this message | ||
Note Submitter: mark at myipower dot com
----
Here is a solution to an earlier comment I found that worked well for me. It only goes 4 deep on a
complex array or object but could go on forever I would imagine.
foreach($_SESSION as $value => $lable1){
echo "The elements of Value1 <B>" . $value . "</B> is <B>" .
$lable1 . "</B><br/>\n";
if(is_array($lable1) || is_object($lable1)) {
foreach($lable1 as $value2 => $lable2){
echo "The elements of Value2 <B>" . $value2 . "</B> is <B>"
. $lable2 . "</B><br/>\n";
if(is_array($lable2) || is_object($lable2)) {
foreach($lable2 as $value3 => $lable3){
echo "The elements of Value3 <B>" . $value3 . "</B>is
<B>" . $lable3 . "</B><br/>\n";
if(is_array($lable3) || is_object($lable3)) {
foreach($lable3 as $value4 => $lable4){
echo "The elements of Value4 <B>" . $value4 . "</Bis <B>"
. $lable4 . "</B>><br/>\n";
}
}
}
}
}
echo "<br>";
}
}