Arman Malekzade Arman Malekzade - 2 years ago 71
PHP Question

Why this php page doesn't work when i add the class?

echo "1";
class grack_node(){
protected $label;
protected $content;
function __construct($label,$content){
function get_label(){return $this->label;}
function get_content(){return $this->content;}
function set_label($label){$this->label=$label;}
function set_content($content){$this->content=$content;}
function set($label,$content){$this->label=$label;$this->content=$content;}

So, Here's a very very simple php code that is a part of a larger code. No matter how large is the real project, this 1 part doesn't work. If i remove the class, i see 1 on the browser. But when i add the class, i don't know what goes wrong and why i don't see anything!
What's the problem with my code ?

Note : display_errors is on. also i added the command
to the first line of my code. Nothing changed!
Thanks in advance.

Answer Source

Class should be defined without the () brackets

class grack_node{
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download