在PHP字符串操作,它是可以操纵的字符串像我们想,例如:阵列中的Java
$temp2 = array();
$theindex = 0;
foreach($arraysimpanloop as $a) {
$temp1 = array();
for($i = 0; $i < sizeof($a)-1; $i++) {
$temp1[$i] = $a[$i];
}
natsort($temp1); // sort array temp1
$stringimplode = implode($temp1);
$temp2[$theindex] = $stringimplode;
$theindex++;
}
由于我使用的是现在,Java,所以我不知道怎么行:
$temp2[$theindex] = $stringimplode;
用Java代码编写。因为我在java中试过:
temp2[theindex]= stImplode; // here temp2 is array of string
它总是返回一个空指针。
你有没有初始化数组第一?就我个人而言,我怀疑该行抛出一个NullPointerException。你能展示你的Java代码和堆栈跟踪吗? – Stultuske 2015-02-09 07:52:00
基于你在这里向我们展示的一行代码:'temp2 [theindex] = stImplode;' - 我们无法帮到你。如果您希望我们帮助您获得NPE,请发布您的代码。 – alfasin 2015-02-09 07:54:02
请添加'java'代码。 – Jens 2015-02-09 07:54:27