ereg_replace(PHP 4, PHP 5) ereg_replace — Replace regular expression Описание
string ereg_replace
( string $pattern
, string $replacement
, string $string
)
This function scans string for matches to pattern , then replaces the matched text with replacement . Список параметров
Возвращаемые значенияThe modified string is returned. If no matches are found in string , then it will be returned unchanged. ПримерыFor example, the following code snippet prints "This was a test" three times:
Пример #1 ereg_replace() example
<?phpOne thing to take note of is that if you use an integer value as the replacement parameter, you may not get the results you expect. This is because ereg_replace() will interpret the number as the ordinal value of a character, and apply that. For instance:
Пример #2 ereg_replace() example
<?php
Пример #3 Replace URLs with links
<?phpПримечанияПодсказка
preg_replace(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg_replace(). |
|
|
| © 2009 Тест скорости интернета | Boont.Ru |