我有以下代码:
<?php
$array1 = array("The price of Mac"=>2000, "One year refundable"=>"Yes", "24/7 support"=>"Yes");
foreach ($array1 as $index => $value) {
if(is_int($value)) {
echo "{$index} is ${$value}, ";
} else {
echo "{$index} is {$value}, ";
}
}
echo "</ br>";
?>
Run Code Online (Sandbox Code Playgroud)
但当我在线上放置一个空格时,2000美元没有出现
if(is_int($value)) {
echo "{$index} is $ {$value}, ";
}
Run Code Online (Sandbox Code Playgroud)
该$ 2000节目了,但如何输出$ 2000年?