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"
";