Horje
php class tostring Code Example
php class tostring
class Role
{
    private $id;
    private $code;
    private $name;
    private $description;

    public function __construct($id, $code, $name, $description)
    {
        $this->id = $id;
        $this->code = $code;
        $this->name = $name;
        $this->description = $description;

    }

    public function __setId($id)
    {
        $this->id = $id;
    }

    public function __getId()
    {
        return $this->id;
    }

    public function __setCode($code)
    {
        $this->code = $code;
    }

    public function __getCode()
    {
        return $this->code;
    }

    public function __setName($name)
    {
        $this->name = $name;
    }

    public function __getName()
    {
        return $this->name;
    }

    public function __setDescription($description)
    {
        $this->description = $description;
    }

    public function __getDescription()
    {
        return $this->description;
    }

}

 $role = new Role(1, "ROLE_ADMIN", "ADMIN ROLE", "Only For Admins");
 echo json_encode($role); // it displays {} empty json
///Bicodev.com




Php

Related
woocommerce get the price from session after add to cart Code Example woocommerce get the price from session after add to cart Code Example
add action hook Code Example add action hook Code Example
join with 2 table where id match in table 1 comma separated Code Example join with 2 table where id match in table 1 comma separated Code Example
PHP catch eval output Code Example PHP catch eval output Code Example
php class extends exception Code Example php class extends exception Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8