Question : array to table?

Hi,
Please see the attached code.  I am struggle to print the array which currently prints to the web page like this:

Array ( [0] => http://www.adriennespizzabar.com/ [1] => http://www.johnsbrickovenpizza.com/ [2] => http://www.firstpizza.com/ [3] => http://www.johnspizzerianyc.com/ [4] => http://www.ottopizzeria.com/ [5] => http://www.eastvillagepizzeria.com/ [6] => http://www.joespizza.com/ ) Array ( [0] => Adrienne's Pizza Bar Restaurant [1] => John's Pizzeria of Bleecker Street [2] => Lombardi's Pizza [3] => John's Pizzeria [4] => Otto Restaurant Enoteca Pizza [5] => East Village Pizza and Kebabs [6] => Joe's Pizza )

But I want it to display in a table like this:

http://www.adriennespizzabar.com/     |  Adrienne's Pizza
http://www.johnsbrickovenpizza.com/  |  John's Pizzeria of Bleecker Street
http://www.firstpizza.com/                  |  Lombardi's Pizza

Can someone please help me with the code to achieve this?

Thanks very much
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
<?php

$page = file_get_contents('http://www.google.com/search?q=new+york+pizza');
 
preg_match_all(
    '@<h4[^>]*class=r[^>]*>\s*<a\s*href="(.*)".*class=l.*title="(.*)".*>@siU',
    $page,
    $matches);
 
print_r($matches[1]); // urls
print_r($matches[2]); // titles

?>

Answer : array to table?

Don't use print_r().

change it to this:
for($counter = 0; $counter < count($matches[1]);$counter++)
{
    echo $matches[1][$counter];
    echo '&nbsp $nbsp | &nbsp &nbsp';
    echo $matches[2][$counter];
    echo '<br />';
}

of course you could modify that code to format the data in any way, including echoing html tags to create a html table.
Random Solutions  
 
programming4us programming4us