I would like to see if the string "profile.php"
ends in or the last 4 charcaters equal ".php"
How can I do this with PHP
Thanks!
I would like to see if the string "profile.php"
ends in or the last 4 charcaters equal ".php"
How can I do this with PHP
Thanks!
Use substr()
to get the last 4 characters, then compare it to the string ".php"
.
if (substr("profile.php", -4) === ".php")
{
echo "Ends in .php";
}
else
{
echo "Doesn't end in .php";
}