- array_map: documentation ( source)
- print_r: documentation ( source)
<?php
class Test {
private $privateProperty = "hello";
public function myMethod() {
$c = function($value) {
return $that->privateProperty." ".$value;
};
$d = $c->bindTo($this);
$that = &$this;
$map = array_map(
$d,
array(
"city",
"world",
"universe"
)
);
return $map;
}
}
$test = new Test();
print_r($test->myMethod());