<?php
$wordFrequencyArray = array();
function countWords($file) use($wordFrequencyArray) { //error here
/* get content of $filename in $content */
$content = strtolower(file_get_contents($filename));
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的代码片段.
我在第3行遇到错误.我有所有匹配的括号.可能有什么问题?
它应该是:
$countWords = function($file) use($wordFrequencyArray) {
//...
};
Run Code Online (Sandbox Code Playgroud)