<?php
$content = '<th class="title">
<div class="subject">
<a href="158391487256182472-1-1.html"
title="Jomashop:Swarovski"></a>
</div>
</th>
<td class="author">
<a href="profile-42357964-1.html"
title="author"><span>cat</span></a>
<span>2017-02-16</span>
</td>
<div class="link0 list-side-hd moderator-noborder obj2subject"><h3
class="fl"></h3></div><ul class="list-side-bd list-recommend
list-recommend2 link1"><li><a target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-94061456905358538-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092826_v2_11861457486906377_58b326482e2aa1f1da0f8455ac42187f.jpg"></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-179021457000027333-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092826_v2_20771457486906773_31eb80d49e9ef06418003e577cc1453f.jpg"></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-93091456983256969-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092827_v2_20231457486907098_05bc3d4608c961af0660722e03049e20.jpg"><span>abc</span></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-13801456844284137-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092827_v2_14121457486907436_d49c002ba8675553c5436e80f305aca7.jpg"><span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span></a></li></ul></div>';
$ret =
preg_match_all('/subject[\s\S]+?href="(.+?)"[\s\S]+?title="([\s\S]+?)"[\s\S]+?profile/',
$content, $matches);
var_dump($matches); // have array result
var_dump($ret); // bug the return value is false
- Output for 7.0.0 - 7.0.27, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- array(3) {
[0]=>
array(1) {
[0]=>
string(147) "subject">
<a href="158391487256182472-1-1.html"
title="Jomashop:Swarovski"></a>
</div>
</th>
<td class="author">
<a href="profile"
}
[1]=>
array(1) {
[0]=>
string(27) "158391487256182472-1-1.html"
}
[2]=>
array(1) {
[0]=>
string(20) "Jomashop:Swarovski"
}
}
int(1)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
array(3) {
[0]=>
array(1) {
[0]=>
string(147) "subject">
<a href="158391487256182472-1-1.html"
title="Jomashop:Swarovski"></a>
</div>
</th>
<td class="author">
<a href="profile"
}
[1]=>
array(1) {
[0]=>
string(27) "158391487256182472-1-1.html"
}
[2]=>
array(1) {
[0]=>
string(20) "Jomashop:Swarovski"
}
}
int(1)
preferences:
160.16 ms | 402 KiB | 190 Q