Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Quick Question regarding: Only variables should be passed by reference


tec4 - 4:41 pm on Sep 11, 2012 (gmt 0)


Just want to better understand why I'd be getting this error:

Strict Standards: Only variables should be passed by reference in /directory...


$to_email = Array();
foreach($_POST as $key => $value) {
if(stripos($key, "contact_") === 0) {
$id = array_pop(explode("_", $key));
$to_email[] = $id;
}
}



But when I change it to the below code, it works fine

$to_email = Array();
foreach($_POST as $key => $value) {
if(stripos($key, "contact_") === 0) {
$id = explode("_", $key);
$id = array_pop($id);
$to_email[] = $id;
}
}


Is it as simple as you are not supposed to modify a string or value from it's original form without actually storing it as it's 'new' value?


Thread source:: http://www.webmasterworld.com/php/4493874.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com