I'm attempting to call the function inputFileTab which reads a text file and puts it into a 2d array, then return the array to the function that called it (contentResume), but so far nothing is being returned. Can anyone answer why? Thanks function contentResume(){ inputFileTab("files/content/resume.txt", ""); for($b=0;$b<count($contents);$b++){ print("<a href=\"files/download/".$contents[$b][0]. "\"><img src=\"".$contents[$b][1]."\"></a>"); print("<br />"); } } function inputFileTab($fileLocation, $nextFunction){ $file=file($fileLocation); for($i=0;$i<count($file);$i++){ $lineExplode=explode("\t",$file[$i]); for($x=0;$x<count($lineExplode);$x++){ $contents[$i][$x]=$lineExplode[$x]; } } if(function_exists($nextFunction)){ $nextFunction($contents); }else{ return($contents); } }
Your syntax is wrong $nextFunction($contents); Looks like you are more familiar with javascript? You will need to eval(); it.