take out a character

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
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

take out a character

Post by Skara »

just curious. don't really need to use it.

But say I have a date that looks like this:
13052005
and if the third character is a 0, take it out (and add -s)
so it would be:
13-5-2005

My question is, is there a function to delete a character? Or could you only use two substr()s?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

substr_replace

or

$var{$character_number} = '-';
Post Reply