How to run a plugin function when a plugin is deactivated – WordPress

<?php
 register_activation_hook(__FILE__, $function);
 //The function "register_deactivation_hook" allow you to run a
 //plugin function  when the plugin is deactivated.
?>