public static function addOrRemoveS($word)
    {
        $arrayOfCharInTable = str_split($word);

        if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1] === 's') {
            array_pop($arrayOfCharInTable);
            $word = implode($arrayOfCharInTable);
        } else {
            $word .= 's';
        }

        return $word;
    }
public static function addOrRemoveS($word)
    {
        $arrayOfCharInTable = str_split($word);

        if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1] === 's') {
            array_pop($arrayOfCharInTable);
            $word = implode($arrayOfCharInTable);
        } else {
            $word .= 's';
        }

        return $word;
    }
public static function addOrRemoveS ( $ word ) { $ arrayOfCharInTable = str_split ( $ word ) ; if ( $ arrayOfCharInTable [ count ( $ arrayOfCharInTable ) - 1 ] === 's' ) { array_pop ( $ arrayOfCharInTable ) ; $ word = implode ( $ arrayOfCharInTable ) ; } else { $ word .= 's' ; } return $ word ; }
Add or remove 's' from the end of a word

@param string $word
@return string $word
Add or remove s from the end of a word