• PHP Video Tutorials

PHP - Ds Map sorted() Function



Ds\Map::sorted() function can return a copy sorted by value.

Syntax

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

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

Example

<?php 
   $map = new \Ds\Map([1 => 30, 2 => 10, 3 => 20]); 
   print_r($map->sorted());  
?>
php_function_reference.htm
Advertisements