Q:

Parse error: syntax error, unexpected '$Contrato' (T_VARIABLE)

I need to get a multidimensional array composed fro a class, when accessing results, I get error Parse error: syntax error, unexpected '$Contrato' (T_VARIABLE) in instruction
print_r $Contrato->getDatosContrato();
Any ideas?
Here is my code
require_once('config.php');

class Contrato {

    public $mainContractor;
    public $MiCodigo;
    public $title;
    public $description;
    public $buyerCompany;
    public $buyerUser; 
    public $buyerUserId; 
    public $categoryCode;
    public $categoryName;

    public function getDatosContrato() {        
        $parametros = array(
                "contract"=> array(
                            "mainContractor" => array(
                                                "id" => $this->mainContractor
                                                ),
                            "MiCodigo" => $this->MiCodigo,
                            "title" => $this->title,
                            "description" => $this->description,
                            "buyerCompany" => array(
                                            "id" => $this->buyerCompany
                                            ),      
                            "buyerUser" => $this->buyerUser,
                            "buyerUserId" => $this->buyerUserId,
                            "categoryList" => array(
                                            "category" => array(
                                                        "categoryCode" => $this->categoryCode,
                                                        "categoryName" => $this->categoryName
                                                        )
                                            )       
                        )
        );
        return $parametros;
    }
}

try 
{

    $BD = new PDO("mysql:host=".DB_HOST.";dbname=".DB_DATABASE, DB_USER, DB_PASSWORD);

    $stmt = $BD->query("SELECT * FROM Contracts");

    $stmt->setFetchMode(PDO::FETCH_INTO, new Contrato);

    foreach($stmt as $Contrato)
    {
        print_r $Contrato->getDatosContrato().'<br />';
    } 

    $BD = null;
}
catch(PDOException $e)
{
    echo $e->getMessage();
}

A:

print_r is a function, so you're missing the brackets:
print_r($something);

A:

print_r needs brackets:
print_r(...);

A:

Use print_r() in this way,
foreach($stmt as $Contrato)
{
    print_r ($Contrato->getDatosContrato());
    echo '<br />';
} 

