Ver original$from = array( "/\[img=\"(.*?)\"\]/is");$to = array( "<img src=\"".pathFromId(."$1".)."\" />");$text = preg_replace($from, $to, $text);