I’m new in php and I’m confusing a lot what is the difference of this sign => for this ->

Asked

Viewed 34 times

0

public function cadastro(Request $request)
{
 $user=new User();
 $user->name= $request->name;
 $user->email=$request->email;
 $user->password= FacadesHash::make($request->password);
 $user->save();
 return redirect()->route('users.listAll');
}


public function formEditUser(User $user){


    return view('editUser',[
        'user'=>$user


    ]);
}

1 answer

2


With => you are associating a key to a array with a value. With -> you are accessing a property or method of a object.

They are not similar, each has a specific purpose.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.