私はオブジェクト指向 PHP に関する本を読んでいて、著者が複雑な構文を使用している場合があることに気付きました。継承に関する章で、彼は以下のコードを使用しています。
// Declare the getSummaryLine() method
function getSummaryLine() {
// Define what the getSummaryLine() method does
$base = "$this->title ( {$this->producerMainName}, ";
$base .= "{$this->producerFirstName} )";
return $base;
}
私の質問は、なぜあなたはただ使わないのですか:
// Declare the getSummaryLine() method
function getSummaryLine() {
// Define what the getSummaryLine() method does
return "$this->title ( $this->producerMainName, $this->producerFirstName )";
}
どちらも同じものを返すように見えますか?
これが痛いほど明白である場合は、ご容赦ください。マニュアルで PHP の複雑な構文を読みましたが、これ以上明確にはなりませんでした。セキュリティの問題なのか、スタイルの選択なのか、それともまったく別のものなのか?