note 106761 deleted from function.usort by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 16:43:55 +0000 |
| Subject: | note 106761 deleted from function.usort by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217841@lists.php.net to get a copy of this message | ||
Note Submitter: admin at gosenz dot com
----
sort multi-dimentional arrays in class with usort
<?php
class ArraySort
{
private $arr = array();
public function __construct($arr)
{
$this->arr = $arr;
}
public function doSort()
{
$cmp = function($a, $b)
{
//Do Some Comparation
}
if(is_array($this->arr))
{
usort($this->arr, $cmp);
}
return $this->arr;
}
}
?>