Self-written functions
Self-written functions
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
You need to define a global variable in your function.
https://www.php.net/manual/en/language. ... .scope.php
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;
}
Re: Self-written functions
Thanks for your help.