$array = array();
$array = $dom->find('a')->each(function ($dom, $array) {
$array[] = $dom->getText();
echo $dom->getText(); // WORKING OK!
return $array;
});
print_r($array); // RETURN EMPTY ARRAY
How can I add values to array outside function? In this example I can get these values and show them in function, but if I add them to array and next return array, then outside function I have empty array.