View Full Version : static method

12-08-2015, 10:14 PM
May someone help with this particular problem please? I have to create a static method (which is called changeCase) in a class called TextFunctions that will change a given string to uppercase letters based on a pararmeter?

The code I have to use (I have to add to this code to get it to work) is as followed:

$string = "Hello, World\n";
echo TextFunctions::changeCase($string, true);
echo TextFunctions::changeCase($string, false);


All I have managed to come up with this far - is this code (as below: code #2), but while it works - output Hello, World! (all uppercase letters). I haven't managed to work into any of the above code (code#1).

class TextFunctions {
public static $string = 'Hello, World!';
static public function strtoupper() {
echo strtoupper(TextFunctions::$string);