was ich versuche zu tun ist, zwei Attribute über das Objekt in der Klasse zu setzen, dann bekomme dieses Attribut, aber ich muss echo oder um den Wert zu drucken, um sicherzustellen, mehr Erklärung in der Fowling Code:php zurück zwei Wert Array-Objekt
class product
{
var $title=" ";
var $price=" ";
function __construct($title1,$price1)
{
$this->title=$title1;
$this->price=$price1;
}
function set_title($newtitle){
$this->title=$newtitle;
}
function get_title() {
return $this->title;
}
function set_price($newprice)
{
$this->price=$newprice;
}
function getProductAtrribute()
{
$x1=$this->title;
$x2=$this->price;
return $allattribute= array("$x1","$x2");
}
}
$chair = new product(" small","chair");
$chair->getProductAtrribute();
, nachdem ich das Attribut i für das Attribut oder Druck echo sie die Array-Wert habe Schwierigkeiten bekommen $ allattribute = arra ("$ x1," $ x2"); bitte helfen, wie ich drucken kann diese Werte
'$ allattribute = $ Stuhl-> getProductAtrribute(); echo $ allattribute [0]. "'. $ allattribute [1];' – splash58
'var_dump ($ stuhl-> getProductAtrribute());' –
ich habe nicht verstanden ich! –