Grabbing first character of a variable help
Posted: Mon Aug 18, 2003 6:35 pm
Hi all,
I have a variable named $holder with a value of "Supreme", what I need to do is grab the first character and make it a variable named $grabbed, so $grabbed would then have a value of "S".
I thought I could do this using fgetc() or maybe fseek(), but I can't find a way to get them to work for me. I know they're intended for when reading from files but it seemed as though they should be usable with a string, but I guess not.
I'd really appreciate any ideas or suggestions on some other commands/functions that might work for doing something like this.
Thanks in advance,
Scott
I have a variable named $holder with a value of "Supreme", what I need to do is grab the first character and make it a variable named $grabbed, so $grabbed would then have a value of "S".
I thought I could do this using fgetc() or maybe fseek(), but I can't find a way to get them to work for me. I know they're intended for when reading from files but it seemed as though they should be usable with a string, but I guess not.
I'd really appreciate any ideas or suggestions on some other commands/functions that might work for doing something like this.
Thanks in advance,
Scott