PDA

View Full Version : How to check if the end of a string is as I want?


chrisvmarle
10-22-2002, 11:34 AM
Hi All,

First of all, I barely use PHP, but I need help on a little issue;

I have a string named $file and I want to check if this string ends with ".wal".

Thanks in advance.
Mzzl, Chris

Ökii
10-22-2002, 12:54 PM
if(substr($file,-4) == ".wal") { // tis a wal file; }

It might be -3, just counts backwards from the end when you use negative integers in substr

chrisvmarle
10-23-2002, 01:26 AM
Thanks it works :p

Mzzl, Chris