How Expensive Is An Engine Swap?

Is it worth it to replace an engine?

.

Are engine swaps illegal?

Can you swap an engine by yourself?

How many hours does it take to swap an engine?