我有简单的代码(字符串是西里尔字母):
<?php
$main_menu = [
'Главная' => ['index.php' => 'fa-home'],
'Загрузить файл' => ['upload.php' => 'fa-cloud-upload'],
"Статистика" => ['statistics.php' => 'fa-bar-chart'],
];
$submenu = [
"Cтатистика" => [ 'Продажи товара' => 'товар' ],
];
foreach($main_menu as $name => $val){
foreach($submenu as $sname => $sval){
echo "$name == $sname <br>";
if($name == $sname){
print_r($sval);
}
}
}
但它不起作用。为什么不比较正确?同时in_array()和array_search()也无法正常工作。字符串没有这样的问题。