Let $A,B$ be two sets.
Let's make a new notation $\cap^*$ such that $A\cap^* B=B$ if $B\subseteq A$, and $A\cap^* B=\emptyset$ if $B\not\subseteq A$.
Is this notation known? Are there any standard mathematical notation for $\cap^*$?
(This is very useful in coding.)
In mathematical notation one uses branches in the definition of the function, like below
$$ A\cap^* B = \begin{cases}B,~\text{if}~B\subseteq A\\ \emptyset,~\text{otherwise}\end{cases} $$ which is pretty much what you've written already, but in a different layout.