Re: Invert case

From: Date: Thu, 01 Jun 2000 08:54:15 +0000
Subject: Re: Invert case
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-774@lists.php.net to get a copy of this message
> Is there any easy way of "inverting" the case of a string, e.g. > invertcase('hello WORLD') should return 'HELLO world'. There's a function like, er, strtr, I think to which you can pass arguments like: - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxz" and "abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXYZ" that translates the characters in the first list to those in the second. The doc's, I recall, say it's safe for the above as it doesn't run around in loops -- i.e. it won't change "A" into "a" and then change it back from "a" to "A" etc.

« previous php.general (#774) next »