create_function() error in badwordsfitler_npm

Viewed 10

Hello, everyone. I am using badwords-filter npm and it is using create_function().
But as you know that function is removed from php 8.
So it is getting error now and I can't sure how to fix it.
If you are familiar with it, please help me.

    private function flattenArray($array)
    {
        $objTmp = (object)['aFlat' => []];

        array_walk_recursive($array, create_function('&$v, $k, &$t', '$t->aFlat[] = $v;'), $objTmp);

        return $objTmp->aFlat;
    }

On the above code, the create_function() is getting error.

0 Answers
Related