I have a functions.php file, in which there is a function that parses the json string, decodes it and returns an array as an argument to the function return $response; . I connect this file to index.php with require('php/functions.php'); at the beginning of the file, and then I try to infer an element of the array:
echo $response['name'] . ',+' . $response['country_name']; But I get the error Notice: Undefined variable: response . Explain why this is happening? After all, if I connect a file with some functions to an index file, does this imply that the functions should be loaded into the main file? And how do I get access to a variable in a function?