Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- prepend operator?
June 18, 2008, 6:25 pm
rate this thread
Is there an operator where I can prepend a string to a string, without
repeating the variable name? I'm aware of the concatenation operator,
where you can do
$string .= $ending;
but I would like to do
$start = "mis";
$middle = "apprehend";
$end = "ing";
echo $string =. $start;
$string .= $end
echo $string =. $start
Re: prepend operator?
Paul Lautman wrote:
I saw that, and my "what uis wrong with" was not meant as an answer but,
rather, I was saying "What's the big deal? It is just so simple to use
this". (Speech inflexion doesn't present itself well on the internet).
Anyway, just for the sake of argument suppose that there were such an
operator and it was =. Then to do the job you would need to say:
$string .= $end;
$string =. $start;
It seems to me that this is more complicated and more typing and more
error-prone than what I presented.