Advertisement
vanchelo

Untitled

Oct 11th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. $time = microtime(true);
  3. $c = $modx->newQuery('modResource');
  4. $c->select(array('id','pagetitle'));
  5. $c->where(array('id:<' => 1000));
  6.  
  7. for ($i = 1000; $i >= 0; $i--) {
  8.     if($c->prepare() && $c->stmt->execute()) {
  9.         $collection = $c->stmt->fetchAll(PDO::FETCH_ASSOC);
  10.     }
  11.     foreach ($collection as $key => $value) {
  12.     echo '<pre>';
  13.         //print_r($value);
  14.         echo '</pre>';
  15.     }
  16. }
  17. echo microtime(true) - $time;
  18.  
  19. $time = microtime(true);
  20.  
  21. for ($i = 1000; $i >= 0; $i--) {
  22.     $collection = $modx->getCollection('modResource',$c);
  23.  
  24.     foreach ($collection as $key => $value) {
  25.     echo '<pre>';
  26.         //print_r($value->toArray());
  27.         echo '</pre>';
  28.     }
  29. }
  30. echo microtime(true) - $time;die;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement