kn3*_*n3l 2 php string equality string-comparison
$x = array(3) {
[0]=> "A - 1"
[1]=> "B - 4"
["Total"]=> "5"
}
Run Code Online (Sandbox Code Playgroud)
尝试:
foreach($x as $k=>$v){
if($k=="Total"){break;}
echo $v."<br>";
}
Run Code Online (Sandbox Code Playgroud)
因为我只想输出:
A - 1
B - 4
Run Code Online (Sandbox Code Playgroud)
但我在输出中没有看到任何内容.
我错了什么?
谢谢