답변 1개 / 댓글 1개
채택된 답변
+20 포인트
$value 를 추가 하였습니다
class UrlChange {
var $matches, $i = 0, $regex = '/(?<=src=")[^"]+/' , $value="" ;
function __construct($search, $replace) {
preg_match_all($this->regex, $search, $matches);
$this->matches = $matches[0];
$this->value=preg_replace_callback($this->regex, array($this, 'call'), $replace);
}
function call($m) { return $this->matches[$this->i++]; }
function getData(){return $this->value;}
}
$bbb= new UrlChange($search, $replace);
$aaa = $bbb->getData();
echo $aaa;
답변을 작성하려면 로그인이 필요합니다.