Try:
ClearAll["Global`*"]; Remove["Global`*"];
(x''[t] + (x[t])^3) /. x[t] -> A Sin[?[t]] /. x''[t] -> D[A Sin[?[t]], {t, 2}]
(*A^3 Sin[?[t]]^3 + A (-Sin[?[t]] Derivative[1][?][t]^2 + Cos[?[t]] (?^??)[t])*)
Or:
ClearAll["Global`*"]; Remove["Global`*"];
x[t_] := A Sin[?[t]];
D[x[t], {t, 2}] + (x[t])^3
(*A^3 Sin[?[t]]^3 + A (-Sin[?[t]] Derivative[1][?][t]^2 + Cos[?[t]] (?^??)[t])*)