PHP code example of davidschwarz / line-number

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

    

davidschwarz / line-number example snippets




use DavidSchwarz\LineNumber\Line;

$startLine = Line::number(0);
$otherLine = $startLine->add(2);

$otherLine->equals($startLine); // FALSE
$otherLine->equals(2);          // TRUE

(string) Line::number(7);       // '7'
Line::number(7)->i;             // 7

Line::number(-1);               // throws ...\NegativeValueError

Line::number(0)->subtract(2);   // throws ...\NegativeResultError