Latest version: pecl install openswoole-4.11.1

y--- layout: docs title: Swoole\Atomic\Long->sub permalink: /docs/modules/swoole-atomic-long-sub function: delc: Swoole\Atomic\Long->sub ( int $value = 0 ) params: - name : value desc : The subtraction value to the atomic counter.


Description

Subtract a value to the a Atomic counter.

Example

<?php
$counter = new Swoole\Atomic\Long(123);
echo $counter->add(12)."\n";
echo $counter->sub(11)."\n";
echo $counter->cmpset(122, 999)."\n";
echo $counter->cmpset(124, 999)."\n";
echo $counter->get()."\n";
Last updated on March 31, 2022