Définition of the intersection multiplicity Let $k$ be an algebraically closed field,and denote by $S$ then ring of polynomials over $k$ with $n+1$ variables.
Consider $Y\subset \mathbb P^n(k)$ a projective variety, and $H$ an hypersurface not containing it.
Let $Z$ be an irreducible component of $H \cap Y$. In Hartshorne, the intersection multiplicity of $H$ and $Y$ along 
$Z$ is defined as the length of the $S_{\mathfrak p}$-module $(S/(I_H+I_Y))_{\mathfrak p}$ where $I_H, I_Y$ and $\mathfrak p$
are respectively the homogeneous ideal of $H$ and $Y$ and the homogeneous prime ideal of $Z$.
Now, does it translate in terms of rings of regular functions? I saw other definitions using the dimension over $k$
of a local ring of regular functions (for instance there: https://en.wikipedia.org/wiki/Intersection_number#Definition_for_algebraic_varieties), but it seems to me the framework was not quite the same.
 A: The example in wikipedia corresponds to $Y = Z_1 \cap \cdots \cap Z_{n-1}$ and $H = Z_n$, but indeed it is a different view, that is pursued there: The wikipedia article cited defines the intersection number, when one cuts $n$ hypersurfaces and gets a zero dimensional intersection whereas Hartshorne analyzes the case of the intersection of an arbitrary projective variety $Y \subseteq \mathbb{P}^n$ with an arbitrary hypersurface $H$.
In fact the definition, that Hartshorne gives of the intersection multiplicity
$$
(1) \quad i(Y,H;Z) = \mathrm{len}_{S_\mathfrak{p}} (S/(I_H + I_Y))_{\mathfrak{p}}
$$
where $\mathfrak{p} = I(Z)$,
is slightly different from the one given in the wikipedia article, because usually one sets:
$$
(2) \quad i(Y,H;Z) =\mathrm{len}_{S_{(\mathfrak{p})}} (S/(I_H + I_Y))_{(\mathfrak{p})}
$$
Here for a graded ring $T$ and homogeneous ideal $\mathfrak{q}$ we have
$T_\mathfrak{q} = \{(t/s) \mid t \in T, s \notin \mathfrak{q}\}$ whereas
$T_{(\mathfrak{q})} = \{(t/s) \mid t \in T \text{ homogenous, } s\notin \mathfrak{q} \text{ homogenous of the same degree as } t\}$
Introducing the algebraic scheme $W = V(I_H + I_Y)$
one has
$$
\mathcal{O}_{W,\mathfrak{p}} = (S/(I_H + I_Y))_{(\mathfrak{p})}
$$
so only (2) above corresponds literally to the (usual) exact definition of intersection multiplicity as it is used in the wikipedia article (or in Fulton's "Intersection Theory").
But in fact (1) and (2) give the same value: One sees this by introducing the canonical filtration
$$0 \to M_{i-1} \to M_i \to S/\mathfrak{p}_i(d_i) \to 0$$
with $i=0,\ldots,m$ and $M_{-1} = 0$ and $M_m = S/(I_H + I_Y)$ and $d_i \in \mathbb{Z}$.
Localizing by $()_\mathfrak{p}$ one gets $i(Y,H;Z) = m'$ by (1) and localizing by $()_{(\mathfrak{p})}$ one gets $i(Y,H;Z) = m'$ by (2), where $m'$ is the number of times $\mathfrak{p}$ appears among $\mathfrak{p}_i$.
The only thing to note for this is
$$(S/\mathfrak{p}(d_i))_{\mathfrak{p}} = (S/\mathfrak{p})_{\mathfrak{p}}$$
and $\mathrm{len}_{S_\mathfrak{p}} (S/\mathfrak{p})_{\mathfrak{p}} = 1$
and
$$(S/\mathfrak{p}(d_i))_{(\mathfrak{p})} \cong x_j^{d_i} (S/\mathfrak{p})_{(\mathfrak{p})} \cong (S/\mathfrak{p})_{(\mathfrak{p})}$$
with $x_j \in S_1$ and $x_j \notin \mathfrak{p}$. Here too we have
$$\mathrm{len}_{S_{(\mathfrak{p})}}(S/\mathfrak{p})_{(\mathfrak{p})} = 1
$$
Addendum: We have proved that $i(Y,H;Z) = \mathrm{len}_{S_{(\mathfrak{p})}} \mathcal{O}_{W,\mathfrak{p}}$. This means $i(Y,H;Z) = \dim_k \mathcal{O}_{W,\mathfrak{p}}$ only for $\dim W = 0$, because $\dim_k (S/\mathfrak{p})_{(\mathfrak{p})}$ is infinite for $\dim (S/\mathfrak{p}) > 0$.
