i want to be able to sort files to get a script to recognise what letter the contents of a variable starts with. i.e how could i make i "dog" = "d" or make "elephant" ="e" thankyou
$var = "dog"; $first_letter = substr($var,0,1);
Thanks a lot man! ooh, one more thing, do you know if there is a way to convert a string to all lowercase or...all lowercase bar the first letter? thankyou
Sure, take a look at these two functions:
http://www.php.net/manual/en/function.ucwords.php
And
http://www.php.net/manual/en/function.strtolower.php
Also, if you're sorting strings, look at this:
http://www.php.net/manual/en/function.strnatcmp.php
One of the things I love about PHP is the very full set of built in string functions.