I need to append a value to two variables.
$a = \"String A\";
$b = \"String B\";
...
$a .= \" more\";
$b .= \" more\";
<
Not really.
$a .= $b .= " more";
Is equivalent to:
$b .= " more";
$a .= $b;
The best way is to write:
$a .= " more";
$b .= " more";
Or (if you have a lot of them) use array with some functions:
#1 - array_map approach
function addMore(&$vars) {
$var .= " more";
}
$array = [$a, $b];
$array = array_map('addMore',$array);
#2 - classic approach:
$array = array($a, $b);
foreach ($array_before as &$var) {
$var .= " more";
}