Ask a Question related to PHP Notes, Design and Development.
-
kruchta@z.pl #1
note 33979 added to function.ereg-replace
I had a need to remove comments from a string. They were started with '[' and ended with ']'. I tried to to this with ereg_replace, but couldn't get to it. However, I managed to make it work with preg_replace, here's how if someone's interested:
preg_replace( '/\[[^\]]+\]/', '', $string );
Don't know why it didn't work with ereg when I removed the '/'s.
----
Manual Page -- [url]http://www.php.net/manual/en/function.ereg-replace.php[/url]
Edit Note -- [url]http://master.php.net/manage/user-notes.php?action=edit+33979[/url]
Delete Note -- [url]http://master.php.net/manage/user-notes.php?action=delete+33979&report=yes[/url]
Reject Note -- [url]http://master.php.net/manage/user-notes.php?action=reject+33979&report=yes[/url]
kruchta@z.pl Guest
-
note 33916 added to function.str-replace
Be aware that when using the "e" option, php escapes any quotes in your sequence. This is a problem when you want to directly use the text you match... -
note 33758 added to function.ereg-replace
If you want to remove html tags from a string just use the function strip_tags (way easier and you can add allowable tags). Pit ---- Manual Page ... -
note 33736 added to function.substr-replace
Here is a simple function to shorten a string and add an ellipsis <?php /** * truncate() Simple function to shorten a string and add an... -
note 33625 added to function.str-replace
Here is a version of the CONVERSION "TO LOWER" and "TO UPPER" CASE. I post it because I saw some functions that don't work. At first, we replace... -
note 33592 added to function.ereg-replace
Excellent Tutorial of Brasilian Portuguese: http://guia-er.sourceforge.net/ ---- Manual Page --...



Reply With Quote

