打印出来的数组显示$career[2]的值是2010-
然而,无论我怎么尝试,这个如果方程不会触发。这些数组变量会在某些方面有所不同吗?
echo $career[2];
if($career[2] == "2010-"){
$career = $career[1];
}
数组$career的print_r显示了这个…
Array (
[0] => BIS career
[1] => CEO of the corp
[2] => 2010-
[3] => Leader of R&D
[4] => 2005-10
);
VAR转储
array(11) {
[0]=> string(316) "BIS career "
[1]=> string(194) " CEO of the corp "
[2]=> string(163) " 2010- "
[3]=> string(160) " Leader of R&D "
[4]=> string(165) " 2005-10 " }
您还可以:
echo "...".$career[2]."...";
它会反映出空格
试题:
preg_replace('/^['pZ'pC]+|['pZ'pC]+$/u','',$str);