echo $path; //working function createList($retval) { echo $path; //not working print \"
If you want it to work, you should use global $path in the function, so it looks outside the function scope.
global $path
Please note that global variables are sent from hell :).