note 93794 deleted from function.preg-replace by danbrown

From: Date: Tue, 29 Sep 2009 22:20:02 +0000
Subject: note 93794 deleted from function.preg-replace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161155@lists.php.net to get a copy of this message
Note Submitter: jp ---- please NEVER use a function like the one in the note below (CapsLock()). Reasons why not to use it: - There is already a strtoupper() function that converts characters to upper case. -There is no reason to declare 27 different variables inside a function when you need to replace a string. You can use the same original variable: $string = preg_replace('a','A',$string); $string = preg_replace('b','B',$string); -There is no need to use preg_replace for simple string replacements. use str_replace('a','A',$string) - it is much much much faster. -This function won´t work for latin characters like á,ã,é,í,ó,ú... -tired of writing more reasons.....

« previous php.notes (#161155) next »