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.