Home  >  Article  >  Backend Development  >  There is no decrByFloat method in the php redis extension, right?

There is no decrByFloat method in the php redis extension, right?

WBOY
WBOYOriginal
2016-08-18 09:16:261396browse

A question involving a user's balance, the format is 10.00, with two decimal places.
The incrByFloat method is used when increasing
But it doesn’t work when decreasing. Can we only read it first, do subtraction, and then set it?

Reply content:

A question involving a user's balance, the format is 10.00, with two decimal places.
The incrByFloat method is used when increasing
But it doesn’t work when decreasing. Can we only read it first, do subtraction, and then set it?

incrByFloat($key, -10.00);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn