Echo array problems

Source: Internet
Author: User
Echo array question & lt ;? Phpwhile ($ row = mysql_fetch_array ($ result) {list ($ x1, $ y1) = explode ('|', $ row ['xyz1']); list ($ x2, $ y2) = explode ('|', $ row ['xyz2']);… Echo array problems
While ($ row = mysql_fetch_array ($ result ))
{
List ($ x1, $ y1) = explode ('|', $ row ['xyz1']);
List ($ x2, $ y2) = explode ('|', $ row ['xyz2']);
......
$ Left = array ($ x1, $ x2 ,......);
$ Top = array ($ y1, $ y2 ,......);
}
$ Notes. = '';
?>



$ X1, $ x2, $ y1, $ y2 stores the TOP and LEFT coordinates of the DIV.
However, only one DIV can be seen after echo and the value of $ left and $ top is not obtained.

If I write
'
Or
'
It can be displayed normally.

Because I want to echo a lot of divs, it is impossible to list them one by one. how can I echo all the divs in a single sentence?

I tried to use for judgment.
For ($ I = 0; I I <100; $ I ++)
{
Echo"
'
";
}
However
'. $ Left ['. $ I. '].' You do not know the correct expression.

In addition
{
List ($ x1, $ y1) = explode ('|', $ row ['xyz1']);
List ($ x2, $ y2) = explode ('|', $ row ['xyz2']);
......
$ Left = array ($ x1, $ x2 ,......);
$ Top = array ($ y1, $ y2 ,......);
}
How can this statement be directly merged into an expression similar to the following?
List ($ left, $ top) = array (explode ('|', $ row ['xyz1']), explode ('| ', $ row ['xyz2']),...)
Otherwise, you have to list them one by one.


------ Solution --------------------
Look at this
PHP code
$ Ar = array ('xy1' => '1, 2', 'xy2' => '3, 4', 'xy3' => '5, 6 ', 'xy4' => '7, 8',), array ('xy1' => '11, 12', 'xy2' => '13, 14 ', 'xy3' => '15, 16', 'xy4' => '17, 18',),); foreach ($ ar as $ r) foreach ($ r as $ v) list ($ x [], $ y []) = explode (',', $ v); print_r ($ x ); print_r ($ y );
------ Solution --------------------
Echo "";

Or:
Echo"

";

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.