// Retrieve each row as an object.// Because no class is specified, each row will be retrieved as a stdClass object.// Property names correspond to field names.while( $obj = sqlsrv_fetch_object( $stmt)) { echo $obj->fName.", ".$obj->lName."<br />";}?>

Notas

If a class name is specified with the optional $className parameter and the
class has properties whose names match the result set field names, the corresponding
result set values are applied to the properties. If a result set field name
does not match a class property, a property with the result set field name is added
to the object and the result set value is applied to the property. The following
rules apply when using the $className parameter:

Field-property name matching is case-sensitive.

Field-property matching occurs regardless of access modifiers.

Class property data types are ignored when applying a field value to a property.

If the class does not exist, the function returns FALSE and adds an error to the error collection.

Regardless of whether the $className parameter is supplied, if a field with no
name is returned, the field value will be ignored and a warning will be added
to the error collection.