--- title: "PDOStatement::fetchObject | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual ms.assetid: 71ad1932-cab3-4c29-8950-f5e82547d3b5 author: David-Engel ms.author: v-daenge --- # PDOStatement::fetchObject [!INCLUDE[Driver_PHP_Download](../../includes/driver_php_download.md)] Retrieves the next row as an object. ## Syntax ``` mixed PDOStatement::fetchObject([ $class_name[,$ctor_args ]] ) ``` #### Parameters $*class_name*: An optional string specifying the name of the class to create. The default is stdClass. $*ctor_args*: An optional array with arguments to a custom class constructor. ## Return Value On success, returns an object with an instance of the class. Properties map to columns. Returns false on failure. ## Remarks Support for PDO was added in version 2.0 of the [!INCLUDE[ssDriverPHP](../../includes/ssdriverphp_md.md)]. ## Example ``` query( "select * from Person.ContactType where ContactTypeID < 5 " ); $result = $stmt->fetchObject(); print $result->Name; ?> ``` ## See Also [PDOStatement Class](../../connect/php/pdostatement-class.md) [PDO](https://php.net/manual/book.pdo.php)