Hello; These messy situations pop up occasionally and I generally try to solve it before posting (sometimes I solve it while I am composing the post). I have developed a system for sampling the status of variables while async request processing is in progress. I am using it to test a search function in development. It is a function that writes variable values to a separate file that can be viewed to analyze progress. I am learning that problems with arguments can cause the “function name must be a string” error; I have hit a strange problem: php seems to think that I am trying to call file() when it sees a code reference variable: Any thoughts? Thank you for time and attention; Jeff K Warning: file() expects parameter 1 to be a valid path, array given in path/fSearchName.php on line 42 code generating error: (fSearchName.php) $_code = function($_a, $_b, $_type, $_samp) { /* $_a: string; $_item['name'], basename($_src) w/o suffix $_b: string; search term $_type: string; 'dir'/'file' return: ['found'] = true || ['bypass'] = true; */ // test code: $_tst = array($_a, $_b, $_type);// //foreach($_out as $_ind=>$_val) //{ //$_tst[count($_tst)] = $_ind.": ".$_val; // } $_it = $_samp($_tst, true, 'testOut.txt’); //<<<< line 42 in error message // //.... etc.... attempts to find $_b in $_a in different circumstances } code that $_samp is a reference to: $_code = function($_vars, $_swich, $_target) { /* $_vars: array; variables to be sampled $_swich: boolean; true/false, true to write sample, false to clear sample file $_target: string; path/file to sample file. */ if($_swich === true && count($_vars) > 0) { $_sample = ''; $_sampleArray = []; for($_itr= 0; $_itr < count($_vars); $_itr++) { $_sampleArray[count($_sampleArray)] = $_vars[$_itr]; } $_sample = implode( $_sampleArray, "\n"); @$_FO = fopen($_target, 'a'); if(!$_FO) { return false; } fwrite($_FO, $_sample."\n"); fclose($_FO); return true; } else if($_swich === false) { @$_FO = fopen($_target, 'w'); if(!$_FO) { return false; } fwrite($_FO, ''); fclose($_FO); return true; } return "error:arguments"; }