PHPSA\Variable::dec PHP Method

dec() public method

Decrement value of the variable
public dec ( )
    public function dec()
    {
        $this->value--;
    }

Usage Example

Example #1
0
 public function testDecValue()
 {
     $variable = new Variable('a', 1, CompiledExpression::INTEGER);
     static::assertSame(1, $variable->getValue());
     $variable->dec();
     static::assertSame(0, $variable->getValue());
     $variable->dec();
     static::assertSame(-1, $variable->getValue());
     $variable->dec();
     $variable->dec();
     static::assertSame(-3, $variable->getValue());
 }