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