アロー演算子「->」
アロー演算子はその左辺にはクラスのインスタンスを取り、右辺には左辺のクラスが持つプロパティ(変数)やメソッド(関数)を指定しプロパティへのアクセス・メソッドの呼び出しを実行します。
// 人間クラス
class Person {
$name;
function __construct($name) {
$this->name = $name;
}
function introduceSelf() {
echo "私の名前は". $this->name"です";
}
}
$taro = new Person("太郎");
echo $taro->$name;
$taro->introduceSelf();
ダブルアロー演算子「=>」
連想配列キーとバリューを示すためのもの
return view('buy/index', ['cartitems' => $cartitems, 'subtotal'=> $subtotal]);
$array = array('apple'=>'りんご', 'peach'=>'もも', 'pear'=>'なし');