- print_r: documentation ( source)
- get_object_vars: documentation ( source)
<?php
$pdo = new PDO("sqlite::memory:");
$pdo->query("CREATE TABLE test (id int, value text)");
$pdo->query("INSERT INTO test VALUES (1, 'value')");
$stmt = $pdo->prepare("SELECT * FROM test WHERE id=1");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_LAZY);
print_r(get_object_vars($row));
foreach ($row as $key => $value) {
echo "$key = $value\n";
}
echo "\$row->value = {$row->value}\n";