From f09f626302b3ed97e1faa77eeaff33161a51eeb2 Mon Sep 17 00:00:00 2001 From: Sarvar <56576654+sarvar-akbarov@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:07:11 +0500 Subject: [PATCH] Added solution in PHP language --- solutions/022.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/solutions/022.md b/solutions/022.md index 1aa2fb5..09f874f 100644 --- a/solutions/022.md +++ b/solutions/022.md @@ -77,4 +77,29 @@ class Solution: return result ``` +#### PHP +```php +class Solution { + + /** + * @param Integer[] $nums + * @return Integer[][] + */ + function findMatrix($nums) { + $result = []; + + while(count($nums)){ + $arr = []; + foreach($nums as $key => $num){ + if(!in_array($num, $arr)){ + array_push($arr, $num); + unset($nums[$key]); + } + } + $result[] = $arr; + } + return $result; + } +} +``` ***NB***: If you want to get community points please suggest solutions in other languages as merge requests.