How to form a ¥test format for all result sets of a For loop.

Source: Internet
Author: User
How to form the ¥test format for all result sets that the For loop comes out of.
For example, I have 100 records in a recordset $row.

for ($k =0; $k <$100; $k + +) {
$arr =array ($a [$k], $b [$k], $c [$k]);
Print_r ($arr);
}
I can now put these 100 loops out, is 100 a only array, I now want to turn this into a two-dimensional array, write hair.

As the result of the above output is
Array ([0] = a1 [1] = B1 [2] = C1)
Array ([0] = ASDF2 [1] = B2DF [2] = B2SD)
Array ([0] = a3 [1] = B3 [2] = B6)
Array ([0] = a4 [1] = b4 [2] = SDFs)

I want the result of this. ,
is $test=array ([0] = a1 [1] = B1 [2] = = C1), array ([0] = ASDF2 [1] = = B2DF [2] = = B2SD), Array ( [0] = = a3 [1] = B3 [2] = B6), Array ([0] = a4 [1] = = B4 [2] = = SDFs)

Share to:


------Solution--------------------


for ($k =0; $k <100; $k + +) {
$arr []=array ("A$k", "B$k", "c$k");
}
Print_r ($arr);
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.