Skip to content

Instantly share code, notes, and snippets.

@nWidart
Created June 27, 2016 20:49
Show Gist options
  • Save nWidart/e311f71fc65d53c91a945b05912593aa to your computer and use it in GitHub Desktop.
Save nWidart/e311f71fc65d53c91a945b05912593aa to your computer and use it in GitHub Desktop.
Return array of all classes implementing the Iterator Interface
<?php
// Source: http://stackoverflow.com/questions/3993759/php-how-to-get-a-list-of-classes-that-implement-certain-interface
print_r(
array_filter(
get_declared_classes(),
function ($className) {
return in_array('Iterator', class_implements($className));
}
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment