Skip to content

Best Practices

Doğan Can Uçar edited this page Sep 10, 2018 · 3 revisions

Comparing objects within the library's classes

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.

JSON serializing

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.

Clone this wiki locally