我想计算文件中的所有双重事件。例如:
$outputArr = array();
foreach($numArr as $k1 => $val){
foreach($val as $k2 => $val2){
$outputArr[$k2] = $numArr[$k1][$k2];
}
$Opos0 = serialize($connect->real_escape_string(var_export($outputArr[0])));
$Opos1 = serialize((int)var_export($outputArr[1]));
$Opos2 = serialize((int)var_export($outputArr[2]));
$Opos3 = serialize((int)var_export($outputArr[3]));
$Opos4 = serialize((int)var_export($outputArr[4]));
$Opos5 = serialize((int)var_export($outputArr[5]));
$Opos6 = serialize((int)var_export($outputArr[6]));
$Opos7 = serialize((int)var_export($outputArr[7]));
$Opos8 = serialize((float)var_export($outputArr[8]));
$Opos9 = serialize((float)var_export($outputArr[9]));
$Opos10 = serialize((float)var_export($outputArr[10]));
$Opos11 = serialize((float)var_export($outputArr[11]));
$Opos12 = serialize((float)var_export($outputArr[12]));
$Opos13 = serialize($connect->real_escape_string(var_export($outputArr[13])));
$query = "INSERT INTO `num_data`(`CalledNum`, `NumCalls`, `uniqueCalls`, `dur1sec`, `dur30sec`, `dur60sec`, `dur90sec`, `dur120sec`,
`grossIncome`, `cogs`, `split`, `netIncome`, `nipuc`, `CallDate`) VALUES ($Opos0, $Opos1, $Opos2, $Opos3, $Opos4, $Opos5, $Opos6,
$Opos7, $Opos8, $Opos9, $Opos10, $Opos11, $Opos12, $Opos13)";
$result = $connect->query($query);
if($result == false){
echo "<p>Error entering data into num_data!</p>";
echo "<pre>", print_r( $query ), "</pre>";
die(mysqli_error($connect));
}
$k2 = 0;
} //Parse numArr info into INSERT command.`
我试过这段代码:
hellohello (this is counted)
hello (not conted)
但它不起作用,我不明白为什么。
答案 0 :(得分:1)
请参阅http://mywiki.wooledge.org/ParsingLs了解for file in $(find ...)
为何错误的原因。
关于主要问题虽然认识到{2,2}
(以及所有其他修饰符)适用于模式中最近的原子,并且字符本身就是一个原子所以你所写的是
h
+ e
+ l
+ l
+ o{2,2}
这不是你想要的。
您希望hello
成为原子,因此群组为:(hello){2,2}
。