warning about ereg.

From: Date: Thu, 24 Aug 2000 23:09:43 +0000
Subject: warning about ereg.
Groups: php.general 
Request: Send a blank email to php-general+get-13546@lists.php.net to get a copy of this message
I had a function in ereg that worked in php3. It was: $login_postulante = strtolower($login_postulante); $str_length = strlen($login_postulante) -1; if ( ereg( "([a-z]{1})([a-z,-,_,0-9]{$str_length})", $login_postulante, $regs ) ) {
    $username="valid";
} else {
    $username="invalid";
} This worked in php3 and when I switched to php4 every username was invalid. After much playing around I found that placing a \ infront of the {$str_length} solved everything... ereg( "([a-z]{1})([a-z,-,_,0-9]\{$str_length})", $login_postulante, $regs ) Why do I now need to escape the { ??? Thanks, Marcelo PS. Please reply to my email since I am not on this list.

« previous php.general (#13546) next »