Fix for undefined function array_column
-
Hi, if you have newer versions of php installed on your server you will notice that plugin doesn′t work. That because “array_column” function was deprecated. You must code your own function for that. The next code is a solution for that problem. Paste it on the top of mail2users.php file (behind first coments):
if (! function_exists(‘array_column’)) {
function array_column(array $input, $columnKey, $indexKey = null) {
$array = array();
foreach ($input as $value) {
if ( !array_key_exists($columnKey, $value)) {
trigger_error(“Key \”$columnKey\” does not exist in array”);
return false;
}
if (is_null($indexKey)) {
$array[] = $value[$columnKey];
}
else {
if ( !array_key_exists($indexKey, $value)) {
trigger_error(“Key \”$indexKey\” does not exist in array”);
return false;
}
if ( ! is_scalar($value[$indexKey])) {
trigger_error(“Key \”$indexKey\” does not contain scalar value”);
return false;
}
$array[$value[$indexKey]] = $value[$columnKey];
}
}
return $array;
}
}
- The topic ‘Fix for undefined function array_column’ is closed to new replies.