PHP code example of carloswph / data-struct

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

    

carloswph / data-struct example snippets


$vector = vector(1, 10, 34, 1, 11, 20);
$stack = stack(2, 4, 78, 2, 1, 445);
$set = set(1, 2, 3, 4, 5);

var_dump($vector);
var_dump($stack);
var_dump($set);

/*

object(Ds\Vector)#3 (6) {
  [0]=>
  int(1)
  [1]=>
  int(10)
  [2]=>
  int(34)
  [3]=>
  int(1)
  [4]=>
  int(11)
  [5]=>
  int(20)
}
object(Ds\Stack)#2 (6) {
  [0]=>
  int(445)
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(78)
  [4]=>
  int(4)
  [5]=>
  int(2)
}
object(Ds\Set)#4 (5) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
  [3]=>
  int(4)
  [4]=>
  int(5)
}

*/