PHP code example of sysvyz / hurl

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

    

sysvyz / hurl example snippets



$fromHex = Node::call(function ($data) {
    return hexdec($data);
});
var_dump($fromHex('a'));
        
//int(10)




$explode = Node::explode('.');
var_dump($explode('a.b'));
//array(2) {
//  [0]=>
//  string(1) "a"
//  [1]=>
//  string(1) "b"
//}





$chain = $explode->implode('-');
var_dump($chain('a.b'));
//string(3) "a-b"




$map = $explode->map($fromHex)->implode('.');
var_dump($map('a.b'));
//string(5) "10.11"




$sort = Node::ARRAY()->sort(function ($a,$b){
    return $a-$b;
});
var_dump($sort([2,5,3,4,1]));
//array(5) {
//  [0]=>
//  int(1)
//  [1]=>
//  int(2)
//  [2]=>
//  int(3)
//  [3]=>
//  int(4)
//  [4]=>
//  int(5)
//}