I have an issue using this code in order to get the appropriate result.
My code:
function check_txt($url, $content) {
global $content;
$result = get_file_contents($url);
$arr = array_filter($result, function($ar) {
return ($ar['txt'] == $content);
});
return $arr[0];
}
I got this error when I execute the code:
Notice: Undefined variable: content in myfile.php
My question is how to pass content variable to function($ar)
? already tried function($ar, $content)
and too global $content;
like the code I posted.