...

View Full Version : If Var Contains Char



the-dream
01-20-2008, 12:21 PM
Hi,

I need to find out if the variable $file 's first character is a '.'! How would this be done??

Mwnciau
01-20-2008, 12:27 PM
if ( substr ( $file, 0, 1 ) == '.' )

GJay
01-20-2008, 01:44 PM
if($file[0] == '.')


you can treat strings as arrays of chars for this if you think it's easier - I can never remember the argument order for substr :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum