How to set a cookie that reminds a user accepted cookies' privacy setting

Great!
Are these methods to be used with <?php if ( ): ?> ?

Would you mind to make an example?