Hi @maijavilkina
Your code looks good, so there must be a logic or syntax error in your filter.
Can you please go through your code an debug it line by line like so:
<?php
echo '<pre>';
print_r( $password );
echo '</pre>';
die;
?>
This will display the given variable and visually prove that your data is correct and that the code runs to this line successfuly