• PHP Video Tutorials

PHP - Ds Sequence sorted() Function


Advertisements

Ds\Sequence::sorted() function can return a sorted copy.

Syntax

public abstract Ds\Sequence Ds\Sequence::sorted([ callable $comparator ] )

Ds\Sequence::sorted() function can return a sorted copy by using an optional comparator function.

Ds\Sequence::sorted() function can return a sorted copy of the sequence.

Example 1

<?php 
   $seq = new \Ds\Vector([2, 7, 1, 9, 6, 5, 12, 20]); 
   print_r($seq->sorted()); 
?>

Example 2

<?php 
   $seq = new \Ds\Vector(["TRR" "SAT", "JAT", "TPP"]); 
   print_r($seq->sorted());
?>
php_function_reference.htm
Advertisements