Trying to pass a an array_map inside a class. Its returning null.

后端 未结 1 1257
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-17 07:25

I have a class with 2 functions. One function has the array map that pass the array to another function within the same class. Unfortunatly the array is dumped as NULL. Any

1条回答
  •  星月不相逢
    2021-01-17 07:51

    To provide an object method as callback, you need a different syntax:

    array_map(array($this, 'filt'), $variables)
    

    http://php.net/manual/en/language.types.callable.php

    0 讨论(0)
提交回复
热议问题