Page 1 of 1
Self-written functions
Posted: Tue Oct 08, 2019 7:41 am
by KimmoFrye
I need to write a function that repeats some actions many times. I wrote a function and call it but the program return that can't call the classes of the program from my function. How it solve?
Re: Self-written functions
Posted: Tue Oct 08, 2019 10:04 am
by kojon
You need to define a global variable in your function.
Code: Select all
// check page 404
function check_page_404($str)
{
global $error_404,$webpage,$path_bad_links,$textfile;
if(!strpos($webpage->get_body(),$error_404))
return false;
// add link to file with bad links
$textfile->add_string_to_file($path_bad_links,trim($str)."
",60) ;
return true;
}
https://www.php.net/manual/en/language. ... .scope.php
Re: Self-written functions
Posted: Tue Oct 08, 2019 12:43 pm
by KimmoFrye
Thanks for your help.