php - Function always returns same value -
i created function in php searches [profile|title] , creates url profile...
function profiletageplorer($message, $url) { $startlinktag = '<a href="' . $url .'">'; $endtag = '</a>'; $res = preg_replace('#(\[profile\|)([a-za-z0-9áčďéěíňóřšťůúýžÁČĎÉĚÍŇÓŘŠŤŮÚÝŽ\s]*)(\])#', $startlinktag . '$2' . $endtag, $message); return $res; }
above in code have following cycle...
foreach ($owners $owner) { // prepare header $ep = new emailprinter(); $ep->setreceiver($owner->email); $ep->setsubject($title); // message $message = profiletageplorer($message, $owner->url); $ep->settext($message); $res = $ep->sendmail(); }
i've checked $owner->url contains unique url each iteration. profiletageplorer function returns same result in every iteration, no matter parameter changing.
this same value equal url first iteration of cycle.