SEO-Board: Free, Fast and Search Engine Optimization Friendly Forum Script
»User: »Password:   Remember Me? 
SEO-Board Forum Software Community / General / Programming / newbe question for index.php
Posted:  15 Jul 2006 11:51
Hello, can't understand the meaning of this foreach structure in index.php:

foreach ($_GET as $var=>$val) {
    if (is_array($val))
        $$var = $val;
    else
        $$var = trim($val);
}

... same for $_[POST] and $_[COOKIE]...

Thank you for your answer, bye.
Posted:  15 Jul 2006 13:22
It emulates php's register_globals on. It is considered bad programming practice, but I don't care. I just started it this way. The big new version (under development) has the opposite code - it unregisters all variables that came from $_GET, $_POST etc.
Posted:  15 Jul 2006 14:06
$_GET,$_POST and $_COOKIE are global arrays since php 4.2.0,
so there's no need to register their value...

Why do you want to unregister their value from the next version?

Sorry, but every time i try to understand the "fundamentals",
the very basic practices of php, i find people that have their personal
ideas about them, so i'm a bit confused...
Posted:  15 Jul 2006 15:07
The code does not register the $_GET, $_POST etc. arrays, but variables in these arrays. The idea is to use $var instead of $_GET['var'] throughout the code.