Strip tags in Rails, Javascript and PHP

Strip tag function is used to remove html tags from the string.
Here I will show you that how to use strip tag in ruby on rails, javascript and php.
#PHP:
Example 1: Remove all html tags.

<?php
$str '

Test1.

text2

';
echo strip_tags($str);
?>

Example 2: Allow p and h1 html tag.

<?php
$str '

Test1.

text2

';
echo strip_tags($str,"

");
?>

#Ruby On Rails
Example 1: Remove all html tags
#model

class User < [...]