From the following code:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
How do I create an array using phpQuery
array(
'Coffee',
'Tea',
'Milk'
);
Here's my first attempt, it is very ugly
$doc = phpQuery::newDocumentHTML(...);
$img = $doc->find('ol');
$list = array();
function attrsrc($i, $v){
global $list;
$list[] = phpQuery::pq($v)->text();
}
phpQuery::each($img, 'attrsrc', new CallbackParam, new CallbackParam);
print_r($list);
Try this: