-3

Recently I upgrade my php and suddenly I got this error

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /modules/Downloads/admin/CategoryModify.php on line 65

    , htmlspecialchars($cidinfo['cdescription'], ENT_QUOTES, _CHARSET) , '</textarea><br />' , _DL_ALLOWED_HTML , '<br />';
while (list($key) = each($AllowableHTML)) echo ' &lt;' , $key , '&gt;';

I wonder if there is a solution for this issue.

I tried to make severals changes replacing with foreach but I guess it is more complex than that.

I've got this one as well trying to play as well deprecated. What should be the solution?

//if( !@get_magic_quotes_gpc() ){
ini_set('magic_quotes_runtime', 0);{
    if( is_array($HTTP_GET_VARS) )
    {
        while( list($k, $v) = each($HTTP_GET_VARS) )
        {
            if( is_array($HTTP_GET_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
                {
                    $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_GET_VARS[$k]);
            }
            else
            {
                $HTTP_GET_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_GET_VARS);
    }

    if( is_array($HTTP_POST_VARS) )
    {
        while( list($k, $v) = each($HTTP_POST_VARS) )
        {
            if( is_array($HTTP_POST_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
                {
                    $HTTP_POST_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_POST_VARS[$k]);
            }
            else
            {
                $HTTP_POST_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_POST_VARS);
    }

    if( is_array($HTTP_COOKIE_VARS) )
    {
        while( list($k, $v) = each($HTTP_COOKIE_VARS) )
        {
            if( is_array($HTTP_COOKIE_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
                {
                    $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_COOKIE_VARS[$k]);
            }
            else
            {
                $HTTP_COOKIE_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_COOKIE_VARS);
    }
}

1 Answers1

0

Your Foreach statement should be written like this:

foreach($AllowableHTML as $key => $value){

     echo "$key"; //This displays the index of the element in the array
     echo "&lt;". $value. "&gt;"; //This displays the value 
}
Kebab Programmer
  • 1,213
  • 2
  • 21
  • 36