- array_walk: documentation ( source)
<?php
class Test
{
private $att = 0;
public function __construct(){}
public function do()
{
$this->att = 42;
$array = ['test1', 'test2', 'test3', 'test4'];
array_walk($array, [$this, 'go']);
}
public function go($value, $key)
{
echo $value,'<br>';
echo $this->att,'<br>';
}
}