- Edited
https://www.php.net/manual/en/function.var-export.php
class Printable1{
public $testone;
public $testtwo;
public function __toString(){
return(var_export($this,TRUE));
}
}
$a = new Printable1;
$a->testone = 5;
$a->testtwo = 'foo';
var_dump($a);
the function __toString() it doesn't return anything I found some examples in the php documentation but I don't know how to use this function.
the var_export() function prints out all the attribute values in the class
public function __toString(){
return(var_export($this,TRUE));
}
this code I found in php documention examples
$a = new Printable1;
$a->testone = 5;
$a->testtwo = 'foo';
var_dump($a);