Wednesday, March 1, 2017

Why I obtain this syntax error tryig to concatenate the content of $data['email'] into this e-mail content message?

I am not so into PHP and I have some problem with this code snippet that should represent an e-mail that I will send:

$token = md5(uniqid($data['email'], true));

DB::insert('insert into pm_user(firstname, lastname, email, login, pass, type, token) values(?, ?, ?, ?, ?, ?, ?)',
            [$data['name'], $data['surname'], $data['login'], $data['email'], md5($data['pass']), 'hotel', $token]);


$registrationMail = [
     'title' => 'Registrazione albergatore su portale BeTrivius',
     'content' => "<p>Hi,<br>You created a new account.<br>
            Click on the link bellow to validate your account:<br>
            <a href=\".getUrl().\"?token=\".$token.\"&email=\".$data['email'].\">Validate my new account</a></p>\";
]

The problem is that PhpStorm sign me error on the $data['email'] variable into the content section of the message. Passing the mouse on this variable it says:

Cannot use [] for reading

So what is the problem? How can I correctly concatenate the content of $data['email'] variable in my e-mail message content?




via blablabla blablabla

Advertisement