php - reset() - "Strict Standards: Only variables should be passed by reference" -
php - reset() - "Strict Standards: Only variables should be passed by reference" -
this question has reply here:
strict standards: variables should passed reference 5 answersi moving website on client. old host must using old version of php can gather. site working on current host. working move new host them , getting next error:
php strict standards: variables should passed reference in /home/parcelt2/core/public_html/loader.php on line 17
below section of code line 17 marked out
$uri = parse_url($_server['request_uri']); if (substr($uri['path'], -1, 1) == '/' && !sizeof($_post)) { $new_uri = substr($uri['path'], 0, -1); if (strlen($new_uri) > 0) { $page = reset(explode('/', $new_uri)); //line 17 if (!in_array($page, $exempt_requests)) { if (isset($uri['query']) && strlen($uri['query']) > 0) { $new_uri .= '?' . $uri['query']; } header('http/1.1 301 moved permanently'); header('location: ' . $new_uri, true, 301); exit; } } }
would able provide prepare or suggestion on how prepare this? have tried reading other posts error have found them hard understand.
thank you
reset() takes reference array (variable) not work result of function call.
you need this:
$arr = explode('/', $new_uri); $page = reset($arr);
however, array returned explode()
have internal pointer set first element. shouldn't need phone call reset @ all.
php reference strict
Comments
Post a Comment