【发布时间】:2014-01-09 06:47:50
【问题描述】:
我有这个伪代码,我一直在尝试为和创建正确的 PHP 语法 我绝对无处可去。我继续在函数 group_job_items 上收到 Parse 错误。
解析错误:语法错误,第 17 行出现意外的“{”
这里有什么问题?任何帮助将不胜感激。
function group_job_items ()
{
$jobs_by_category = array();
foreach ($category_name as $category_id => $name)
{
foreach ($job_item as $item)
{
// skip job items that do not match the current category
if ($item["category_id"] != $category_id) continue;
if (!isset ($jobs_by_category[$name])
{
// create a list of jobs for the current category
$jobs_by_category[$name] = array();
}
// add the current job item to the current category
$jobs_by_category[$name][] = $item
}
}
}
【问题讨论】:
-
计算左括号和右括号;你错过了一个结束。
标签: php if-statement foreach