Skip to content
archaeron edited this page Mar 20, 2011 · 2 revisions

sample data

<?php

$query = new PHPQuery();

$query->from($sample_data);
$query->where('id', function($a){ return $a != 5; });
$query->where('price', function($p){return $p > 300;});
$query->select('id', 'name');
// or: $query->select(array('id', 'name'));

foreach($query as $elem)
{
    var_dump($elem);
}

// result
array(2) {
  ["id"]=>
  int(4)
  ["name"]=>
  string(7) "bicycle"
}
array(2) {
  ["id"]=>
  int(6)
  ["name"]=>
  string(8) "computer"
}

?>
Clone this wiki locally