![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| thank you once again for your replies, they have been very helpful ... I would like to ask the following :- I have a variable called $filename How do I cut out the first character of $filename and assign it to $firstchar ? How do I change $firstchar to lowercase if it is in uppercase ? Thanks Andy | |||
|
| Advertisements |
| | #2 | ||
| On 7-Jul-2003, "Andy Yeo" <kheemeng@lycos.com> wrote: > I would like to ask the following :- > > I have a variable called $filename > > How do I cut out the first character of $filename and assign it to > $firstchar ? http://www.php.net/manual/en/function.substr.php > > How do I change $firstchar to lowercase if it is in uppercase ? http://www.php.net/manual/en/function.strtolower.php -- Tom Thackrey www.creative-light.com | |||
|
| | #3 | ||
| hi andy, > I have a variable called $filename > How do I cut out the first character of $filename and assign it to > $firstchar ? $firstchar = $filename{0}; $firstchar = substr($filename, 0, 1); $firstchar = preg_replace('/^(.).*/s', '\\1', $filename); > How do I change $firstchar to lowercase if it is in uppercase ? $firstchar = strtolower($firstchar); so you're probably searching for: $firstchar = strtolower($filename{0}); regards, steffen -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ | |||
|
| | #4 | ||
| To make sure it is a char value and not a string value, use chr: $firstchar = chr( $filename[0] ); "Andy Yeo" <kheemeng@lycos.com> wrote in message news:3f0a25fa$1@news.starhub.net.sg... > thank you once again for your replies, they have been very helpful ... > > I would like to ask the following :- > > I have a variable called $filename > > How do I cut out the first character of $filename and assign it to > $firstchar ? > > How do I change $firstchar to lowercase if it is in uppercase ? > > Thanks > > Andy > > | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: char, functions, help, php |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C++ question: How to change base class members in functions that don't know about the derived class | Shavais | Software Programming | 3 | 06-12-2007 10:23 PM |
| PHP5 Static functions called through __call() that don't exist... yet | Jared Farrish | Pear | 2 | 05-20-2007 6:34 PM |
| Featured Websites | ||||
|