Let S be a semigroup, and let φ, ψ: S → S be two endomorphisms (which are not necessarily involutive). Our main goal in this paper is to solve the following generalized variant of d’Alembert’s functional equation
f
(
x
ϕ
(
y
)
)
+
f
(
ψ
(
y
)
x
)
=
2
f
(
x
)
f
(
y
)
,
x
,
y
∈
S
,
f\left( {x\varphi \left( y \right)} \right) + f\left( {\psi \left( y \right)x} \right) = 2f\left( x \right)f\left( y \right),\,\,\,\,\,\,x,y\, \in \,S,
where f : S → ℂ is the unknown function by expressing its solutions in terms of multiplicative functions. Some consequences of this result are presented.