1public function getAvg(string $var) {
2 # A sample from a game I wrote.
3 # Concatenatin on the other side is just {stuff.$var}
4 # You can also concatenate multiple variables in a varaible:
5 # {$varA.$varb}
6 $min = $this->{$var._min};
7 # Assigns to $min object property matching $var + '_min' string.
8 $max = $this->{$var._max};
9 # Assigns to $max object property matching $var + '_max' string.
10 $avg = (($min + $max) / 2);
11 return round($avg);
12}
1
2<?php
3$a = "Hello ";
4$b = $a . "World!"; // now $b contains "Hello World!"
5
6$a = "Hello ";
7$a .= "World!"; // now $a contains "Hello World!"
8?>
9
10
1$string = "the color is ";
2$string .= "red";
3
4echo $string; // gives: the color is red