Small problem with function..

From: Date: Mon, 12 Jun 2000 14:27:42 +0000
Subject: Small problem with function..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1619@lists.php.net to get a copy of this message
Hi! I have problem with small function. This function doesn't work as expected, and consume all available memory and kills apache server. Here goes my function: function strdelc ( $string, $chars ) { $chars_len = strlen ( $chars ); for ( $cnt = 0; $cnt < $chars_len; ++$cnt ) { $char = substr ( $chars, $cnt, 1 ); while ( ( $pos = strpos ( $string, $char ) ) || is_int ( $pos ) ) { if ( $pos == 0 ) { $string = substr ( $string, pos + 1 ); } elseif ( $pos < strlen ( $string ) - 1 ) { $string = substr ( $string, 0, $pos - 1 ) . substr ( $string, pos + 1 ); } else { $string = substr ( $string, 0, $pos - 1 ); } } } return ( $string ); } Is this any problem with text assignment ??? Or where is my fault ?? Please help.. -- pozdrawiam.. ## ## | Sylwester Zarębski - ISP Group | #### ## | e-mail: sylwek@isp.net.pl | ## ## ## | ICQ uin: #45780888 | ## #### ## | Administrator ISP.NET.PL |

« previous php.general (#1619) next »