Callback-based array adapter for PHP