PHP code example of phpdk / pdk
1. Go to this page and download the library: Download phpdk/pdk 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/ */
phpdk / pdk example snippets
$int = new TInt(1);
$int->getValue(); // return int 1
TInt::instanceof(1); //true
TInt::instanceof(new TInt(1)); //true
TInt::instanceof('1'); //false
//compare
$int = new TInt(5);
static::assertTrue($int->equals(5));
static::assertTrue($int->less(6));
static::assertTrue($int->lessEquals(5));
static::assertTrue($int->more(4));
static::assertTrue($int->moreEquals(5));
static::assertTrue($int->equals(new TInt(5)));
static::assertTrue($int->less(new TInt(6)));
static::assertTrue($int->lessEquals(new TInt(5)));
static::assertTrue($int->more(new TInt(4)));
static::assertTrue($int->moreEquals(new TInt(5)));
static::assertFalse($int->equals('5'));
static::assertFalse($int->equals(new TString('5')));
$string = new TString("hello world");
[$hello, $world] = $string->split(' ');
$array = (new TArray(['1', '2', '3']))->map(function() {
//foreach
});
$array = (new TArray(['1', '2', '3']))->filter(function() {
//foreach
});
$collection = new TList(A::class);
$collection = TList::new(A::class, [...]);
#scalar
$list = new TList(TInt::class);
$list->add(new TInt(0));
$list->add(1);
$list->add(2);