PHPSA\Variable::inc PHP Method

inc() public method

Increment value of the variable
public inc ( )
    public function inc()
    {
        $this->value++;
    }

Usage Example

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