打印时的以下数组显示$ career [2]的值是2010 - 。
然而,无论我尝试什么,这个if方程都不会触发。这些数组变量能以某种方式变化吗?
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 DUMP
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 " }
答案 0 :(得分:1)
你也可以这样做:
echo "...".$career[2]."...";
它将反映空间
尝试:
preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str);