PHP code example of xp-framework / core

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

    

xp-framework / core example snippets


 namespace examples;

use util\{Date, Dates};
use util\cmd\Console;

$span= Dates::diff(new Date($argv[1]), Date::now());
Console::writeLine('Hey, you are ', $span->getDays(), ' days old');



use util\{Date, Dates};
use util\cmd\Console;

class AgeInDays {

  public static function main(array $args): int {
    $span= Dates::diff(new Date($args[0]), Date::now());
    Console::writeLine('Hey, you are ', $span->getDays(), ' days old');
    return 0;
  }
}
sh
$ xp ageindays.script.php 1977-12-14
Hey, you are 16015 days old