Mailinglisten-Archive |
Hallo Liste,
innerhalb von preg_replace funktioniert (!stristr("$1","?")? "?" : "&")
nicht. Warum?
Hier mein kompl. Testcode:
$text = '
<a href="foo.php">link1</a><br>
<a href="foo.php?foo=bar">link2</a><br>';
$suchmuster = '/href="(.*?)"/is';
$text = preg_replace($suchmuster, "/href=\"$1".(!stristr("$1","?")? "?" :
"&")."foo2=bar2\" ", $text);
Wenn ich das nicht innerhalb von preg_replace aufrufe funktioniert es:
echo (!stristr("foo.php?foo=bar","?")? "?" : "&");
echo (!stristr("foo.php","?")? "?" : "&");
Wer hat ein Tip für mich...
Beste Grüße
Marcel
php::bar PHP Wiki - Listenarchive