I am new to Magento.I want to get invoice details by its id using object manager but unable to get it. I tried this.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')->load('506585');
print_r($order->getData());
$invoiceCollection = $order->getInvoiceCollection();
foreach($invoiceCollection as $invoice){
print_r(invoiceCollection);
}