index.php:
require 'modulename.php';
$keyword = $_GET['q'];
getResults();
modulename.php:
$config = ... ;
$service = ... ;
function getResults($config, $service, $keyword) {
...
}
... but this throws an error:
Missing argument 2 for getResults(), called in index.php on line xx and defined in modulename.php
... it seems the function is not using the already defined variables, how do I make it use those?
function getResults($config, $service, $keyword)tofunction getResults($config = false, $service = false, $keyword = false)to make them optional if thats what you want$configand$serviceis already defined outside the function, I just need to use them as function arguments.