Last active
March 29, 2017 08:33
-
-
Save smokills/c67619ac153dc42cc9ec1f3f5d5b54a7 to your computer and use it in GitHub Desktop.
Return an array that contains the value of the given column name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function extract_field($object, $field) { | |
return array_column( | |
array_map(function($e) { | |
return (array)$e; | |
}, (array)$object), | |
$field); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment