<?php $string = " is PHP"; $pattern = "/PHP$/"; if(preg_match($pattern, $string)) print("Found a match!"); ?>