Title: Fix for undefined function array_column
Last modified: May 19, 2017

---

# Fix for undefined function array_column

 *  Resolved [juandomina](https://wordpress.org/support/users/juandomina/)
 * (@juandomina)
 * [9 years ago](https://wordpress.org/support/topic/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; } }

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Karam Singh](https://wordpress.org/support/users/sony7596/)
 * (@sony7596)
 * [9 years ago](https://wordpress.org/support/topic/fix-for-undefined-function-array_column/#post-9151164)
 * Hi I have tested, above code its giving error. Also I have tested its working
   fine. I will update if any issue raised.
 *  Thread Starter [juandomina](https://wordpress.org/support/users/juandomina/)
 * (@juandomina)
 * [9 years ago](https://wordpress.org/support/topic/fix-for-undefined-function-array_column/#post-9155570)
 * Oh sorry! If you have older versions of php, you´re a gonna need array_columns,
   because it was introduced in php 5.5

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fix for undefined function array_column’ is closed to new replies.

 * ![](https://ps.w.org/mail2users/assets/icon-256x256.png?rev=1575479)
 * [Mail to Users](https://wordpress.org/plugins/mail2users/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mail2users/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mail2users/)
 * [Active Topics](https://wordpress.org/support/plugin/mail2users/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mail2users/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mail2users/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [juandomina](https://wordpress.org/support/users/juandomina/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/fix-for-undefined-function-array_column/#post-9155570)
 * Status: resolved