HosipLan

Untitled

Dec 19th, 2011
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. <?php
  2.  
  3. class Foo
  4. {
  5.  
  6.     public function bar()
  7.     {
  8.         return array_map(array($this, 'mapper'), array(1, 2, 3));
  9.     }
  10.  
  11.    
  12.     private function mapper($i)
  13.     {
  14.         return $i + 1;
  15.     }
  16.  
  17. }
  18.  
  19.  
  20. $foo = new Foo();
  21. var_dump($foo->bar()); // array(2, 3, 4);
Advertisement
Add Comment
Please, Sign In to add comment