So you can do this in both languages:
eval ('$product = 6 * 12');
Avoid this kind of code. It is compiled and executed at runtime. If you are ever unsure what could end up in the dynamic string then this could be a very dangerous thing to do. Avoid entirely, there is always a better way to code this.