3v4l.org

run code in 300+ PHP versions simultaneously
<?php print("PDO::FETCH_ASSOC: "); print("Return next row as an array indexed by column name\n"); $result = $sth->fetch(PDO::FETCH_ASSOC); print_r($result); print("\n"); print("PDO::FETCH_BOTH: "); print("Return next row as an array indexed by both column name and number\n"); $result = $sth->fetch(PDO::FETCH_BOTH); print_r($result); print("\n"); print("PDO::FETCH_LAZY: "); print("Return next row as an anonymous object with column names as properties\n"); $result = $sth->fetch(PDO::FETCH_LAZY); print_r($result); print("\n"); print("PDO::FETCH_OBJ: "); print("Return next row as an anonymous object with column names as properties\n"); $result = $sth->fetch(PDO::FETCH_OBJ); print $result->NAME; print("\n");

preferences:
27.54 ms | 402 KiB | 5 Q