note 86978 modified in function.get-defined-vars by thiago

From: Date: Thu, 13 Nov 2008 12:04:25 +0000
Subject: note 86978 modified in function.get-defined-vars by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146477@lists.php.net to get a copy of this message
I would suppose the following code: <?php session_cache_limiter('nocache'); # unterlasse das caching @session_start(); echo "Die Session-ID lautet: ".session_id()."<br>"; ############### functions ########################### function GetPostSession( &$vari, $bgfarbe, $bgarray, $fontfarbe) { echo "<font color='".$fontfarbe."' >"; echo "<table width='50%' align='center' cellpadding='4' cellspacing='0' bgcolor='".$bgfarbe."' border='1'>"; echo "<tr><td align='center' colspan='2'> Die ".$vari."- Uebergabewerte: </td></tr>"; foreach( $vari as $key => $value ) { echo "<tr>"; if (gettype($value)=="array") { echo "<td colspan='2' allign ='center'><table width='100%' align='center' cellpadding='4' cellspacing='0' border ='1' bgcolor='".$bgarray."'>"; echo "<tr><td colspan='2' align='center' >ARRAY: ".$key." </td></tr>"; foreach ($value as $Schl => $wert) { echo "<tr>"; echo "<td align='center'>".$Schl."</td><td allign='center'>".$wert."</td>"; echo "</tr>"; } echo "</table></td>"; } else { echo "<td align='center'>"; echo $key.": </td><td align='center'> ".$value; echo "</td>"; } echo "</tr>"; } echo "</table>"; echo "</font>"; } # end of function 1 ########################################### function ev() { foreach($GLOBALS as $key => $value) { echo '<p>'.$key.' - '.$value.'</p>'; if ( gettype($value)=="array" ) { GetPostSession( $value, 'white', 'yellow', 'red' ); } } } ev(); ?> --was-- I would suppose the following code: <? session_cache_limiter('nocache'); # unterlasse das caching @session_start(); echo "Die Session-ID lautet: ".session_id()."<br>"; ############### functions ########################### function GetPostSession( &$vari, $bgfarbe, $bgarray, $fontfarbe) { echo "<font color='".$fontfarbe."' >"; echo "<table width='50%' align='center' cellpadding='4' cellspacing='0' bgcolor='".$bgfarbe."' border='1'>"; echo "<tr><td align='center' colspan='2'> Die ".$vari."- Uebergabewerte: </td></tr>"; foreach( $vari as $key => $value ) { echo "<tr>"; if (gettype($value)=="array") { echo "<td colspan='2' allign ='center'><table width='100%' align='center' cellpadding='4' cellspacing='0' border ='1' bgcolor='".$bgarray."'>"; echo "<tr><td colspan='2' align='center' >ARRAY: ".$key." </td></tr>"; foreach ($value as $Schl => $wert) { echo "<tr>"; echo "<td align='center'>".$Schl."</td><td allign='center'>".$wert."</td>"; echo "</tr>"; } echo "</table></td>"; } else { echo "<td align='center'>"; echo $key.": </td><td align='center'> ".$value; echo "</td>"; } echo "</tr>"; } echo "</table>"; echo "</font>"; } # end of function 1 ########################################### function ev() { foreach($GLOBALS as $key => $value) { echo '<p>'.$key.' - '.$value.'</p>'; if ( gettype($value)=="array" ) { GetPostSession( $value, 'white', 'yellow', 'red' ); } } } ev(); ?> http://php.net/manual/en/function.get-defined-vars.php

« previous php.notes (#146477) next »