array_map / create_function
<?php class Bar { public function test() { $ar = array( 1, 2, 3, 4, 5 ); //$result = array_map( array(& $this, 'func'), $ar ); $result = array_map( create_function('$x', 'return $x * $x;'), $ar ); echo '<pre>'; print_r( $result ); echo '</pre>'; } private function func( $x ) { return $x * $x; } } $b = new Bar(); $b->test(); ?>