1.2.600. Interpolation¶
The following strings contain variables that are will be replaced. However, the following characters are ambiguous, and may lead to confusion.
It is advised to add curly brackets around those structures to make them non-ambiguous.
<?php
class b {
public $b = 'c';
function __toString() { return __CLASS__; }
}
$x = array(1 => new B());
// -> after the $x[1] looks like a 2nd dereferencing, but it is not.
print "$x[1]->b";
// displays : b->b
print "{$x[1]->b}";
// displays : c
?>
See also Double quoted.
1.2.600.1. Connex PHP features¶
1.2.600.1.1. Specs¶
Short name |
Type/StringInterpolation |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |