From ab758c7e526e6ed4715800f232c8b8e566d8c93e Mon Sep 17 00:00:00 2001 From: Sarvar <56576654+sarvar-akbarov@users.noreply.github.com> Date: Tue, 4 Jul 2023 06:59:17 +0500 Subject: [PATCH] Added solution in PHP language --- solutions/035.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/solutions/035.md b/solutions/035.md index 98e7232..9595850 100644 --- a/solutions/035.md +++ b/solutions/035.md @@ -76,4 +76,27 @@ class Solution: return count ``` +#### PHP +```php +class Solution { + + /** + * @param String[][] $items + * @param String $ruleKey + * @param String $ruleValue + * @return Integer + */ + function countMatches($items, $ruleKey, $ruleValue) { + $result = 0; + foreach($items as $item){ + $result += match ($ruleKey) { + 'type' => intval($item[0] == $ruleValue), + 'color' => intval($item[1] == $ruleValue), + 'name' => intval($item[2] == $ruleValue), + }; + } + return $result; + } +} +``` ***NB***: If you want to get community points please suggest solutions in other languages as merge requests.