string manipultion

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
dannymc1983
Forum Commoner
Posts: 80
Joined: Wed Feb 16, 2005 7:24 am

string manipultion

Post by dannymc1983 »

anyone know how to insert characters at the front of a string? say for example if i had the string "cde" and wanted to insert the charachters 'a' and 'b' at the front to make it "abcde".
i know array_push will insert charcters but it puts them at the end. anyone know of a function that will do what im trying to do?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

$string = 'cde';
$appender = 'ab';
$newstring = $appender.$string;
Post Reply