Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("content-type: text/plain");
- class AnswerInfo
- {
- public $question;
- public $answer;
- public $questiontypeid;
- public $constructid;
- public $construct;
- public $comment;
- }
- try {
- $dbh = new PDO("mysql:dbname=test;host=localhost", "root", "");
- } catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
- }
- $stmt = $dbh->prepare("SELECT * FROM answer_info");
- $stmt->execute();
- $before = microtime(true);
- while( $obj = $stmt->fetchObject('AnswerInfo') )
- {
- $after = microtime(true);
- //var_dump($obj);
- echo "Took " . ($after - $before) . " microseconds.".PHP_EOL;
- $before = microtime(true);
- }
- $after = microtime(true);
- echo "Took " . ($after - $before) . " microseconds.".PHP_EOL;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement