コードの 2 つの部分をマージしようとしています。そのためには、複数回呼び出す関数からのエコーされた配列列出力を、計算を実行できる配列に格納する必要があります。
これが私がやろうとしていることです:
<?php
$searchquery[1] ="jupiter";
$searchquery[2] ="venus";
//can be multiple queries
include ('find.php');
for($i=0;$i<count($searchquery);$i++)
{
find($searchquery[$i]);
}
/find.php echoes back to me a MySQL query which then
creates a 2 dimensional array for me called
/$searchresult which looks like this as an example
t x (let's call first column t for example, and second x)
|1|3|
|1|4|
|2|6|
|4|8|
|7|1|
and it echoes it back to me, this works.
But, i need to use the first column (t) (11247) output from find.php
which was the result of the searchquery "jupiter",
and i need to store it as some sort of array in this current sheet,
theni need to store the "venus" searchquery which is let's say
t x
|1|3|
|2|4|
|3|4|
|4|6|
|5|4|
この現在のシートに最初の列 (t) を配列として格納します。
現在のシートで次の操作を実行できるように、find.php 関数からのエコーを配列として保存しようとしています。
$venusarrayt = array(1, 1, 2, 4, 7); //the manually defined
//$searchresult first column output from find.php which echos to me (t) (11247)
$jupiterarrayt = array(1, 2, 3,4,5); //the manually defined
//$searchresult first column output from find.php which echos to me (t) (12345)
//I need to perform the following operation and sum all of the t combinations
for($l=0;$l<count($venusarrayt);$l++){
for($s=0;$s<count($jupiterarrayt);$s++){
echo $venusarrayt[$l]+$jupiterarrayt[$s];
この部分は機能します!$searchresult
しかし、エコーされた出力を上記の for ループを実行できる配列にマージするのに問題があります。この例では、php シートに「venusarrayt and jupiterarrayt」と入力して手作業で行っています。
複数回呼び出す関数からのエコーされた配列列の結果を配列に格納する方法があると確信していますが、その方法はまだわかりません。助けてください。