Date: 10/31/00
- Next message: Daniel T. Gorski: "Re: [PHP-DEV] PHP 4.0 Bug #7554: Exclusive flock() breaks client/servercommunication"
- Previous message: torben <email protected>: "[PHP-DEV] PHP 4.0 Bug #7524 Updated: Cannot start apache (undefined symbol: zend_ini_close_file)"
- In reply to: clcollie <email protected>: "[PHP-DEV] PHP 4.0 Bug #7553: RFC: Uplevel Block structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[clip]
>
> With the proposed Uplevel syntax, the previous code would look like this ...
>
> function export_script_vars( $var_names ) {
> $result = "";
> uplevel {
> foreach ($var_names as $var_name) {
> $result .= '<input type=hidden name="$var_name" value = "${$var_name}"/><br>'
> }
> return $result;
> }
> }
>
> With this addition, this opens great possibilities, though i can imagine the need to also be cautious.
>
> Thanks for making PHP the great tool it is!
It's not hard to write a function that does as such without the use of a
structure like that, though I can't see it being bad to have-- example:
function export_script_vars($var_names) {
$result = "";
foreach ($var_names as $var_name) {
$result .= '<input type="hidden" name="$var_name" value="${$GLOBALS["$var_name"]}" /><br />
}
return $result;
}
This works provided that you are calling this from the top-level, and if
not, you have to export your variables out to the top level with $GLOBALS.
It should work, though.
Chris
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Daniel T. Gorski: "Re: [PHP-DEV] PHP 4.0 Bug #7554: Exclusive flock() breaks client/servercommunication"
- Previous message: torben <email protected>: "[PHP-DEV] PHP 4.0 Bug #7524 Updated: Cannot start apache (undefined symbol: zend_ini_close_file)"
- In reply to: clcollie <email protected>: "[PHP-DEV] PHP 4.0 Bug #7553: RFC: Uplevel Block structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

