php - Array to string conversion -
php - Array to string conversion -
what's problem of code? don't it. error code:
notice: array string conversion in c:\xampp\htdocs\stage\ripper.php on line 12 array blockquote
notice: array string conversion in c:\xampp\htdocs\stage\ripper.php on line 13 array
<?php header('content-type: text/html; charset=utf-8'); $url = "http://www.asaphshop.nl/epages/asaphnl.sf/nl_nl/objectpath=/shops/asaphnl/products/80203122"; $htmlcode = file_get_contents($url); $pattern = "/itemprop=\"description\"\>(.*)\<\/div\>(.*)\<li\>taal:(.*)\<\/li\>(.*)\>(.*)\<\/div\>\<li\>(.*)\data-src-l\<\/li\>/su"; preg_match_all($pattern, $htmlcode, $matches); print_r ($matches); $description =($matches[1]); $language = ($matches[3]); echo $description; echo $language ?>
when utilize preg_match_all
, $matches
2-dimensional array. $matches[1]
, $matches[3]
both arrays. echo
works numbers or strings, warning when seek echo array. if want see what's in them, utilize print_r()
or var_dump()
:
print_r($description); print_r($language);
php arrays string preg-match-all
Comments
Post a Comment