I have a functon that is passed an array of url's. I am extracting data from each webpage and then assigning each piece of data to an array. Here's my function:
function getitems ($urls) {
$iteminfo = array();
foreach($urls as $link) {
$circdl = my_curl($link);
$circqp = htmlqp($circdl,'body');
$itemtitle = $circqp->branch()->find('div[class="col-item"]')->children('img')->attr('title');
$itemlink = $circqp->branch()->find('div[class="col-item"]')->children('img')->attr('src');
$itemdesc = $circqp->branch()->find('div[class="col-item"]')->children('img')->attr('alt');
$iteminfo[][] = $itemtitle;
//$iteminfo[$itemtitle][] = $itemlink;
//$iteminfo[$itemtitle][] = $itemdesc;
}
return $iteminfo;
}
I want the array to look like this:
Array ( [0] => Array ( [0] => title [1] => link [2] => desc ) [1] => Array ( [0] => title [1] => link [2] => desc ) [2] => Array ( [0] => title [1] => link [2] => desc ) )
But I can't wrap my head around how to additional fields to the sub-arrays.