Citace Původně odeslal l_iNu$ Zobrazit příspěvek
By se to dalo treba jeste zapsat tak ze za ten regulerni vyraz das modifikator e a pak do retezce co se ma nahradit muzes pouzit libovolny php kod...

PHP kód:
preg_replace("/\[download=(.*),(.*)\]/e",'$co = "<a href="/download/\\1">\\2</a>(".filesize("download/\\1").")"',$co); 
/e switch se nedoporucuje pouzivat z bezpecnostnich duvodu ...



a navic co tak koukam do diskuze na php.net
Note that it is in most cases much more efficient to use preg_replace_callback(), with a named function or an anonymous function created with create_function(), instead of the /e modifier. When preg_replace() is called with the /e modifier, the interpreter must parse the replacement string into PHP code once for every replacement made, while preg_replace_callback() uses a function that only needs to be parsed once.