Page 1 of 1

string question

Posted: Thu Apr 01, 2004 12:56 pm
by cto1mac
Ok say I have this:

$var = "A8";

What do I do to get just the "A" from that variable?

Thanks.

Posted: Thu Apr 01, 2004 1:05 pm
by pickle
[php_man]substr[/php_man]

Posted: Thu Apr 01, 2004 1:15 pm
by cto1mac
Seriously, you guys on the forums have saved me from ripping my hair out once again.

Thanks

Posted: Thu Apr 01, 2004 1:27 pm
by redmonkey
Alternatively....

$var{0} will return the first character of $var.

Posted: Thu Apr 01, 2004 2:07 pm
by vigge89
just a question, you can't do $var{0-10}, right?

Posted: Thu Apr 01, 2004 2:12 pm
by markl999
Right, you can't ;)