php在类中使用回调函数 如array_map
<?php
class foo {
var $var;
function bar() {
array_map(array($this, "baz"), array(1,2,3));
}
function baz($arg) {
$this->var = $this->var + $arg;
}
}
?> //https://www.php.net/manual/zh/function.array-map.php
<?php
class foo {
var $var;
function bar() {
array_map(array($this, "baz"), array(1,2,3));
}
function baz($arg) {
$this->var = $this->var + $arg;
}
}
?> //https://www.php.net/manual/zh/function.array-map.php