363d1bb20f
This change is mostly for FB internal organizational reasons. Building is not effected beyond the fact that the target now lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
27 linhas
506 B
PHP
27 linhas
506 B
PHP
<?php
|
|
|
|
class Callbacks {
|
|
public $count = 0;
|
|
public function filter($n) {
|
|
$this->count++;
|
|
return $n % 2;
|
|
}
|
|
|
|
public static $scount = 0;
|
|
public static function sfilter($n) {
|
|
self::$scount++;
|
|
return $n % 3;
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
$a = array(1,2,3,4,5,6,7,8);
|
|
$cb = new Callbacks();
|
|
var_dump(array_filter($a, array($cb, 'filter')));
|
|
echo $cb->count . " times\n";
|
|
|
|
var_dump(array_filter($a, array('Callbacks', 'sfilter')));
|
|
echo Callbacks::$scount . " times\n";
|
|
}
|
|
main();
|