- array_map: documentation ( source)
- print_r: documentation ( source)
<?php
class A
{
public function testAnonFunc()
{
$testArray = array(1, 2, 3);
$result = array_map(
function ($x, $y) {
$x = $x + 1;
return $x;
},
$testArray
);
return $result;
}
}
$a = new A();
print_r($a->testAnonFunc());