
SwooleTable::decr 메서드는 레코드 값을 줄이는 데 사용할 수 있습니다. 이 메서드는 레코드 값을 1씩 줄입니다.
#hostingforum.kr
php
$table = new SwooleTable(10, 2);
$table->column(0, ['name' => 'int', 'default' => 0]);
$table->create();
$table->set(1, ['count' => 10]);
echo $table->get(1)['count'] . "n"; // 10
$table->decr(1, 'count');
echo $table->get(1)['count'] . "n"; // 9
레코드가 0 이하일 때는 0이 됩니다.
#hostingforum.kr
php
$table->decr(1, 'count');
echo $table->get(1)['count'] . "n"; // 0
$table->decr(1, 'count');
echo $table->get(1)['count'] . "n"; // 0
2025-08-14 23:38