Is there a way to save the value of variables while the recursive call is made? What will happen to $totalNumResources and $totalSize?
I want PHP to hold the variables that will be returned once the start function returns from the recursive call. I don't want it to be modified as a parameter.
This is not duplicate with question here.
function start($URL) {
if (!check_if_html($URL)) {
$totalSize = get_remote_file_size($URL);
echo "Download Size: $totalSize Bytes ";
$totalNumResources += 1; //single resource is an HTTP request
echo "HTTP requests: $totalNumResources";
return;
}
$totalNumResources += 1;
foreach ($html->find('iframe') as $element) {
echo "IFRAME" . "$element->src.\n";
start($element->src);
}
}