1. Go to this page and download the library: Download rumd3x/php-countable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rumd3x / php-countable example snippets
use use Rumd3x\Countable\Counters\BasicCounter;
$counter = new BasicCounter(10);
while (!$counter->isZero()) {
// Do stuff...
$counter->decrement();
}
use use Rumd3x\Countable\Counters\BasicCounter;
$counter = new BasicCounter();
foreach($myArrayOfStuff as $value) {
// Do stuff...
$counter->incrementBy($value->quantity);
}
echo "Found {$counter->getCounter()} stuff";
/** Incrementable **/
public function increment(): int; // Increment the counter by one and returns the previous value
public function incrementBy(int $incrementQuantity): int; //Increments the counter by incrementQuantity and returns the previous value
/** Decrementable **/
public function decrement(): int; // Decrements the counter by one and returns the previous value
public function decrementBy(int $decrementQuantity): int; // Decrements the counter by decrementQuantity and returns the previous value
/**
* Retrieve the current counter value
* @return integer
*/
public function getCounter(): int;
/**
* Returns true if the counter is zero, false otherwise
* @return boolean
*/
public function isZero(): bool;
/**
* Returns true if the counter is less than zero, false otherwise
* @return boolean
*/
public function isNegative(): bool;
/**
* Returns true if the counter is greater than zero, false otherwise
* @return boolean
*/
public function isPositive(): bool;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.