У меня есть этот класс:
<?php
class config {
var $config="";
public function __construct($d) {
switch(strtolower(trim($d))) {
case "sql":
$this -> config = array(...);
break;
}
}
public function toString() {
return $this -> config;
}
}
?>
$c = new config("sql");// calling the class
echo $c; //error
Я получаю следующую ошибку:
( ! ) Catchable fatal error: Object of class config could not be converted to string in ..
почему не работает?