Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print ">" on every line

Tags:

php

How would I do to print a ">" before every line?

if ($quoteid) {
echo ' 
> '.$quote['message'].' 
'; 
}

Currently It Looks like this:

> I would move Heaven and Hell and anything in between to get to you. 
You wouldn't be safe anywhere if I was mad at you.
And that's not bull; that's truth. I've went up against people.
You could pull a gun on me and if I'm mad at you I'm coming forward.
You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.

I want it to look like this:

> I would move Heaven and Hell and anything in between to get to you. 
> You wouldn't be safe anywhere if I was mad at you.
> And that's not bull; that's truth. I've went up against people.
> You could pull a gun on me and if I'm mad at you I'm coming forward.
> You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.
like image 911
Rocky Avatar asked Jul 13 '10 12:07

Rocky


2 Answers

if ($quoteid) {
    // Replace new line with new line + "> "
    echo '>' . str_replace("\n", "\n> ", $quote['message']);
}
like image 131
ConroyP Avatar answered Oct 07 '22 21:10

ConroyP


if ($quoteid) { 
   echo ' > '.str_replace("\n","\n > ",$quote['message'])';  
} 
like image 29
Mark Baker Avatar answered Oct 07 '22 20:10

Mark Baker