???? ? ??? ?? ???? ? ????? ? ??????? PunBB ???? ???????.
3 2004-03-24 19:12
Re: replace part of string. (5 replies, posted in Programming)
<?php
$text = "this is some text and this [img]http://url_to_image[/img] is an image";
$text = ereg_replace("\\[img\\](http://[-~a-zA-Z_0-9/.+;%&?|=:]+)\\[/img\\]",
"<a href='\\1' target='_blank' border='0'><img src='\\1' width='100'></a>",
$text);
?>