- strtoupper: documentation ( source)
<?php
class Test
{
public $data = [];
function __construct($data){
$this->data = $data;
}
function &getIterator() {
foreach ($this->data as $key => &$value) {
yield $key => $value;
}
}
function printData()
{
foreach ($this->data as $key => $value) {
echo($key . ':' . $value . PHP_EOL);
}
}
}
$data = array('one'=>'Curly', 'two'=>'Larry', 'three'=>'Moe');
$t = new Test($data);
foreach ($t->getIterator() as $key => &$value) {
$value = strtoupper($value);
}
$t->printData();