Re: Append to begining of a String

From: Date: Tue, 20 May 2003 22:56:21 +0000
Subject: Re: Append to begining of a String
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148342@lists.php.net to get a copy of this message
on 20/05/03 7:33 PM, Shaun (shaun@mania.plus.com) wrote: > how can I add something to the beginning of a string? Actually, that would be called a prepend. An append would be adding something to the end :) prepend: $old = 'something'; $new = 'blah '.$old; //OR $new = "blah {$old}"; //OR append: $old = 'something'; $old .= ' else'; // str $old is now "something else" OR $new = $old.' else'; // OR $new = "{$old} else"; Take your pick :) Justin

« previous php.general (#148342) next »