我正在尝试检查我是否$subCat
在数组中有值,然后不要添加它。我应该最终得到一个,$subCat
但是当我转储时,$details
我仍然得到完整的数组。为什么是这样?
foreach ($detailsFunction as $main)
{
$mainlisting = $main['listingId'];
$mainCat = strtolower($main['mainCat']);
$subCatO = strtolower($main['subCat']);
$subCat = str_replace(" ", "-", $subCatO);
if(isset($subCat) && $subCat == $subCat)
{
$details[] = array('url' => base_url().'listings/'.$mainCat.'/'.$subCat,
'mainCat' => $main['mainCat'],
'subCat' => $main['subCat']
);
}
}