[英]How do I store the content generated?
I have a code as shown below.This code throws our values says, 0.5 seconds on the output screen since I have run a foreach loop. 我有一个如下所示的代码,因为我运行了一个foreach循环,所以该代码在输出屏幕上抛出了0.5秒的值。 Now, I want to work around with my variables $var1 , $var2 , $var3 (which is are got my a imposing a few functions on $value).
现在,我想使用变量$ var1 , $ var2 , $ var3 (这是我在$ value上加几个函数的方法)。
foreach ($predefinedarray as $key => $value) {
if ($predefined_var == NULL) {
print "<b>$value</b> could not be processed.<p>";
} else {
print "$var1,$var2,$var3>";
}
}
Now, I want to get all $var1 after the whole foreach is done with the constraint that $var2 = "foo" ; 现在,我想在整个foreach完成之后使用$ var2 =“ foo”的约束条件来获取所有$ var1 ; How do I do this?
我该怎么做呢? Do i need to use SQL Databases for this or is there a simpler way of using javascript, jquery etc?
我是否需要为此使用SQL数据库,或者是否有使用javascript,jquery等的更简单方法?
PS: Also, I want to make a download option that lets me download this data. PS:另外,我想选择一个下载选项,使我可以下载此数据。 So, I'm assuming once I figure out how the above data is tored, I can probably work around this too.
因此,我假设一旦弄清了上面的数据是如何计算的,我大概也可以解决此问题。
Thanks! 谢谢! John
约翰
Didn't really got what you were trying to say but as i understood 1)you iterate array and get the values suppose $value 2)you do something with $value and get 3 values $var1,$var2,$var3 3) you want the all $var1 when $var2="foo" 确实没有得到您想要说的内容,但据我所知1)您迭代了数组并假设$ value的值为值2)您使用$ value进行了一些操作,并获得了3个值$ var1,$ var2,$ var3 3)您当$ var2 =“ foo”时需要全部$ var1
if this is what the question is then i suggest you create another array and fill the with $var1 data when $var2="foo" like 如果这是什么问题,那么我建议您创建另一个数组,并在$ var2 =“ foo”这样的情况下用$ var1数据填充
$the_var1_array=array();
foreach ($rawlist as $key => $value) {
if ($id == NULL)
{
print "<b>$value</b> could not be processed.<p>";
}
else
{
print "$var1,$var2,$var3>";
if($var2=="foo")
{
$the_var1_array[]=$var1;
}
}
}
Now that you have the array iterate through it and get all the $var1 现在,您可以遍历数组并获取所有$ var1
Hope I understand the question right 希望我理解正确的问题
I thought of that.
我想到了 But what if my "foo" is some variable that depends on my input array from the user?
但是,如果我的“ foo”是某个变量,该变量取决于用户的输入数组,该怎么办?
Isn't that exactly what $varx are also? 那不是$ varx也是吗? Function results depending on the input ($rawlist)?
函数结果取决于输入($ rawlist)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.