Is it possible to do object++ in php?
I'am just wondering if something like this is possible, if so how would I achive something like this?
Example:
class x
{
private $data = 0;
}
$a = new x();
$a++;
I assume you are trying to increase the variable $data inside the class x?
If so, you will want to do something like this:
class x
{
private $data = 0;
public function increaseData()
{
$this->data++;
}
}
$a = new x();
$a->increaseData();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With