This doesn't have anything to do with precedence and only tangentially related to order of evaluation. The function parameters are evaluated left to right, not right to left (assuming this is what you were referencing, Jaxel), although this doesn't matter here as the only function with a parameter is echo, and it only has one. The string concatenation operator is left associative. Some operators are right associative (or even non-associative).
Precedence only comes into play when talking about operators. For instance if I were to give you 5+8*2 the answer is ambiguous. It could either equal 26 or 21. However, multiplication has a higher precedence than addition, so the parser sees this as a tree (forgive the ugly ASCII tree, hopefully it displays properly):
PHP:
Correct: Wrong:
+ *
/ \ / \
5 * + 2
/ \ / \
8 2 5 8
So the correct way adds 5 to the multiplication of 8 and 2 (21). The wrong way multiplies the addition of 5 and 8 to 2 (26). This is precedence.
Order of evaluation is subtly different. Take 5-5-5 as an example. The subtraction operator is used twice, so it obviously has the same precedence level, so how do we evaluate this expression? This could either be (5-5)-5 which is -5, or 5-(5-5) which is 5. Quite a big difference. So let's construct another poor ASCII tree keeping in mind that the subtraction operator is left associative.
PHP:
Wrong: Correct:
- -
/ \ / \
5 - - 5
/ \ / \
5 5 5 5
The subtraction operator is left associative, so it has a left leaning, or left heavy tree. So the proper way to calculate 5-5-5 would be (5-5)-5 which is -5. That is the correct way subtracts 5 from the subtraction of 5 and 5. I'll leave it as an exercise to draw 5-5-5-5. Also, assignment (=) is an example of a right associative operator.
So why go through all of this? Well this stuff depends heavily on how a language can be parsed. In the previous cases ambiguities can arise quite easily, so precedence and associativity are needed so there are no ambiguities (at least one would hope). So let's look at your example, and I'll try to keep it as simple as possible, just note that the AST would be much more complex than this in a real compiler/interpreter.
PHP:
echo
|
.
/ \
String getName
|
echo
|
$this->name
There is no ambiguity here. Now I said that this is tangentially related to order of evaluation. This is because the concatenation operator is left associative. If it were right associative String and getName (and its children) would be swapped. However, it doesn't matter if they were swapped because it would evaluate to the same string, "MarcYour name is ". In either case it will execute the second echo first, and then finish the concatenation operation (which effectively does nothing), and then finish the first echo call. In both cases this could be rewritten as:
PHP:
function getName()
{
echo $this->name;
}
$mytest->getName(); // Outputs "Marc"
$string = 'Your name is ' . ''; // Concatenate "Your name is" to the empty string
echo $string; // Outputs "Your name is " on the same line as the previous output
// Full Output: "MarcYour name is "
Basically this problem has more to do with how a parse tree is read and less to do with how a parse tree is constructed.
So that's why things happened the way they did. Hope that helps.