I have a chat and the messages are printed more or less like this:
Jhon: Hey!
Jhon: Fine?
Smith: Yeah, I'm fine. Thanks.
Jhon: That's nice!
To print that i have the code:
array(4) {
[0]=>
array(3) {
["from"]=>
string(4) "Jhon"
["to"]=>
string(5) "Smith"
["msg"]=>
string(4) "Hey!"
}
[1]=>
array(3) {
["from"]=>
string(4) "Jhon"
["to"]=>
string(5) "Smith"
["msg"]=>
string(5) "Fine?"
}
[2]=>
array(3) {
["from"]=>
string(5) "Smith"
["to"]=>
string(4) "Jhon"
["msg"]=>
string(23) "Yeah, I'm fine. Thanks."
}
[3]=>
array(3) {
["from"]=>
string(4) "Jhon"
["to"]=>
string(5) "Smith"
["msg"]=>
string(12) "That's nice!"
}
}
I want to show the messages like this:
Jhon: Hey!
Fine?
Smith: Yeah, I'm fine. Thanks.
Jhon: That's nice!
Thank you and sorry for my English.