can not get $myString to work or the __call function is not working

[php]<?php
class CleverString {
private $_theString="";
private Static $_allowedFunctions=array(“strlen”, “strtoupper”, “strpos”);
public function setString($stringVal) {
$this-> _theString = $stringVal;
}
public function getString() {
return $this-> _theString;
}
public function __call($methodName, $argments) {
if (in_array($methodName, CleverString::$_allowedFunctions)) {
array_unshift($arguments, $this-> _theString);
return call_user_func_array($methodName, $arguments);
} else {
die(“

Method ‘CleverString::$methodName’ doesn’t exist

“);
}
}
}
$myString = new CleverString;
$myString-> setString(“Hello!”);
echo"

The string is: “.$myString-> getString().”

”;
echo"

The length of the string is: “.$myString-> strlen().”

”;
echo “

The string in uppercase letters is: “.$myString-> strtoupper().”

”;
echo"

The letter e occurs at position: “.$myString-> strpos(“e”).”

";
$mystring->madeUpMethod();
?>[/php]

This is a class project that was suppose to just type in and walla it works. I have fixed a few mistakes but I can not figure out why I do not get a the variable $myString->strlen() or any of the other string functions to work.

Sponsor our Newsletter | Privacy Policy | Terms of Service