PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
cto1mac
Forum Commoner
Posts: 54 Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA
Post
by cto1mac » Thu Apr 01, 2004 12:56 pm
Ok say I have this:
$var = "A8";
What do I do to get just the "A" from that variable?
Thanks.
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Apr 01, 2004 1:05 pm
[php_man]substr[/php_man]
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
cto1mac
Forum Commoner
Posts: 54 Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA
Post
by cto1mac » Thu Apr 01, 2004 1:15 pm
Seriously, you guys on the forums have saved me from ripping my hair out once again.
Thanks
redmonkey
Forum Regular
Posts: 836 Joined: Thu Dec 18, 2003 3:58 pm
Post
by redmonkey » Thu Apr 01, 2004 1:27 pm
Alternatively....
$var{0} will return the first character of $var.
vigge89
Forum Regular
Posts: 875 Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden
Post
by vigge89 » Thu Apr 01, 2004 2:07 pm
just a question, you can't do $var{0-10}, right?
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Thu Apr 01, 2004 2:12 pm
Right, you can't