PHP code example of aviator / prefixed-number

1. Go to this page and download the library: Download aviator/prefixed-number 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/ */

    

aviator / prefixed-number example snippets


$object = new PrefixedNumber($number, $prefix, $padding);

$object->value(); // returns a string representation of the object. 

$object = new PrefixedNumber(99, 'X');

$incremented = $object->increment(); // Returns a new instance of PrefixedNumber
$decremented = $object->decrement(); // As does this

echo $object->value(); // 'X99'
echo $incremented->value(); // 'X100'
echo $decremented->value(); // 'X98'

$object = new PrefixedNumber(99, 'X');

$reset = $object->reset(); // Returns a new instance

echo $object->value(); // 'X99'
echo $reset->value(); // 'X1'

$valueObject = PrefixedNumber::parse('X99', new MyLittleParser());