- array_map: documentation ( source)
- var_dump: documentation ( source)
<?php
class Foo {
private $x;
public function __construct($x) {
$this->x = $x;
}
private function transform($y) {
return $this->x + $y;
}
public function woo($a) {
return array_map(array($this, 'transform'), $a);
}
}
$foo = new Foo(10);
var_dump($foo->woo(array(1,2,3,4)));