Needing to remove a few characters

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

Post Reply
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Needing to remove a few characters

Post by Bigun »

I need to remove the first two characters from a string, how do I do that?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

substr
Last edited by Benjamin on Mon Jun 19, 2006 2:11 pm, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

$string = 'blahblah';

echo substr($string, 2);
Edit | Too late :(
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Post by Bigun »

Why is this code:

Code: Select all

$b-uid = substr($_COOKIE["cg_uid"], 2);
Giving me this error:

Code: Select all

Parse error: parse error, unexpected '='
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

- is not a valid variable character
Post Reply