- var_dump: documentation ( source)
- range: documentation ( source)
<?php
$q = range(0, 100);
$result = array();
foreach($q as $key => $value) {
if (0 === $value % 2) {
$obj = new StdClass();
$obj->key = $key;
$obj->value = $value;
$result[] = $obj;
}
}
var_dump($result);