private function Photo($m,$photo){
if($m == 'print'){
print $photo; // or echo
}
else {
return $photo;
}
}
private function GetText(){
...
...
$i = $res->fetch_assoc();
$Text = $i["Text"];
Now `$Text` have next:
html text
....
<p>%photo(2)%</p>
<p>%photo(3)%</p>
<p>%photo(4)%</p>
...
html text
echo $Text;
}
I would like replace text %photo(N)% (where N - it any number) on function Photo($m,N) (or function Photo(N)).
For this i use code:
$Text = preg_replace_callback("/\{photo\((\d+)\)\}/","Photo",$Text);
But it not work...
Tell me please how make it ?
P.S.: After replace $Text my example should been next:
html text
....
<p>2</p>
<p>3</p>
<p>4</p>
...
html text