First, mysql_real_string_escape() is only for MySQL and is only available when there is a connection to a database! mysql_real_string_escape() and addslashes() do the same as much as I know, but as the first is developed with MySQL it self it is more likely to be better treating MySQL queries. In older releases of PHP, addslashes() had some bugs that I don't think exist now.
But stripslashes() is the opposite! It strips the back slashes instead of adding them.
So use addslashes() when doing anything not related to a certain DB management system, and use the appropriate function when treating a certain DBMS (as mysql_real_string_escape() for MySQL or pg_escape_string() for PostgreSQL).