sidrs Posted April 4, 2011 Report Share Posted April 4, 2011 Ar kādu funkciju var noteikt cik aizvietošanas ir veiktas? $patterns[1] = '/:nosaukums:/'; $replacements[1] = '<img src=img/atels.gif>'; $patterns[2] = '/:nosaukums2:/'; $replacements[2] = '<img src=img/atels2.gif>'; $patterns[3] = '/:nosaukums3:/'; $replacements[3] = '<img src=img/atels3.gif>'; ... $text = preg_replace($patterns, $replacements, $text); un ja ir vairāk par 2 aizvietošanām, izvada tikai pirmās divas. Quote Link to comment Share on other sites More sharing options...
briedis Posted April 4, 2011 Report Share Posted April 4, 2011 RTFM http://php.net/manual/en/function.preg-replace.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.