-
-
Notifications
You must be signed in to change notification settings - Fork 93
Best Practices
Doğan Can Uçar edited this page Sep 11, 2018
·
3 revisions
Sorting and searching consists a lot of comparing. Implement doganoo\PHPAlgorithms\Common\Interfaces\IComparable
if you want PHPAlgorithms to work best when comparing your own classes\objects. The implementation is based on PHP's strcmp() method. The method returns an integer with the following meaning:
- 0: object1 equals object2
- -1: object1 less than object2
- 1: object1 greater than object2
I try to make every data structure class of the library JSON serializable. To serialize each object within a data structure, make sure that you also implement the JsonSerializable
interface.