Wish and If only

Dollars

When we want something to be different than it is we can make sentences with wish or if only.

Wish

Present
subject wish subject past simple  
I wish I had a million dollars.
I wish I could speak Chinese.
I wish she lived nearer.

It is the same construction as the second conditional. As with the second conditional it is an unreal situation.
Also as with the 2nd conditional, when we use the verb to be we can use the were form for all forms of the verb.

subject wish subject past simple  
I wish she were here.
I wish I were rich.
Past

When we want something to have been different in the past we use the following construction:

subject wish subject past simple  
I wish I had gone out last night.
I wish I had seen that film.
I wish I hadn’t eaten so much.

It is the same construction as the third conditional. Like the third conditional it refers to a situation in the past which can’t be changed.

If only

If only has basically has the same meaning although we use it when we are slightly more desperate.

Present
If only subject past simple  
If only I had a million dollars.
If only I could speak Chinese.
If only she lived nearer.

As with wish, if only has the same construction as the second conditional, so it is an unreal situation and when we use the verb to be we can use the were form for all forms of the verb.

Past
If only subject past simple  
If only I hadn’t gone out last night.
If only I had seen that film.
If only I hadn’t eaten so much.

As with wish, it has the same construction as the 3rd conditional and so refers to a hypothetical situation in the past which can’t be changed.